iis - Redis Hash on C# is incredibly slow in WCF Service -


i'm new redis started playing redis hashes store objects , came across unexpected performance issues. i'm running redis on ubuntu machine hosted locally on vmware player.

my vm 2 cores 4 gb of memory.

heres code i'm trying.

using (var redis = new redisclient()) {                   using (var client = redis.as<myclass>())     {         var hash = client.gethash<guid>("urn:class");                            var items = hash.values;     } } 

the hash contains 2000 items added our entity model. values out of hash taking 7 seconds during runs seems way high little bit of hardware redis has in instance. normal linq entity query same data taking .25 seconds.

is there i'm doing wrong here? seems wrong considering great things hear redis performance.

edit: 07/12/2013

this apperas wcf issue. post using redis scale web services mirrors results. did test this.

retrieve redis hash 1683 objects

  • wcf service in iis: 7 seconds
  • asp.net web api: 0.8 seconds
  • nodejs fun: 0.8 seconds

web api , node ran charm , ran close times when ran redis-benchmark.

my issue class using context redis client. class entity model generated using old version of entity framework object context. way entities being generated causing servicestack.redis client have ton of work deserialize objects coming redis. entities navigation property's set methods have calls to

initializerelatedcollection()

which being called every time json parser had deserialize object coming through redis client. switching simpler object without navigation properties worked fine , brought times numbers expected in line other tests.

the reason did not see slow down in asp.net web api because entities generated using new dbcontext model , json serializer in servicestack didn't have amount of work did in wcf project because navigation properties simple lists or collections.

it not great idea make entity object type redis client in first place.


Comments