Closed bigerock closed 6 years ago
Little bit hard to tell without a sample app to reproduce it. There must be something fishy going on in your app which slows it down.
The configuration looks ok from what I can tell, except the usage of GzJson and Json serializer. I think it will use the second one, you cannot use both together.
You'd have to trace your app to figure out what takes long per request, and maybe double check in the place where you inject the instance, if it is really a singleton or not, maybe you messed up something with the DI setup, can happen ;)
Thank you. I’ll see if I can debug it a lower-level or try to get a sample project up. Thank you for your quick response.
sorry, i left out the code that does the actual binding ...
kernel.Bind(typeof(ICacheManager<>)).ToMethod(context => CacheFactory.FromConfiguration(context.GenericArguments[0], cacheConfig)).InSingletonScope();
Is the call into getting the cache item taking forever, or the initial connection attempt? Can you post a subset around of the lines of code that is actually freezing?
Thanks for replying. I'm trying to get an example project together. I'm off work this week and will get it posted next week. It seems just the sheer number of calls to redis is causing the slowness. Which is why I thought it is something in the connection (not a Singleton perhaps). A few calls is fine but like a hundred and it's crazy slow.
It it is really just a few hundred calls then there must be something wrong in the code. You should be able to do 1000s of calls easily. Or you try to store like insane large data structures? An example would be really great to see what you are trying to do ;)
Not very large data structures. I was able to get something reproduced with just using a date time data structure.
We ran into similar issue and had to rollback at the moment. Will try to contribute and create a PR.
ok i've finally got a working example. it saves and retrieves 500 datetime values. locally its taking several seconds (closer to a full minute) and i would think that it would be much faster than that. if you could take a look and see what kind of values you're getting i'd appreciate it.
just replace your redis connection settings in the web.config
Hey @bigerock, I checked your repository and ran the website a few times and the site loads in <1sec for me, all 500 dates being the same all the time, meaning it takes less than 1 second to create those 500 keys, although you do 2 gets and some strange things on every insert. Redis server was running locally.
So, in short, I cannot reproduce the slow behavior.
What kind of redis server are you using? Which version? Is it running on your local box or somewhere else?
@bigerock can you try running a performance profiler like Redgate ANTS on it?
On Tue, Nov 14, 2017, 7:12 PM MichaC notifications@github.com wrote:
Hey @bigerock https://github.com/bigerock, I checked your repository and ran the website a few times and the site loads in <1sec for me, all 500 dates being the same all the time, meaning it takes less than 1 second to create those 500 keys, although you do 2 gets and some strange things on every insert. Redis server was running locally.
So, in short, I cannot reproduce the slow behavior.
What kind of redis server are you using? Which version? Is it running on your local box or somewhere else?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/MichaCo/CacheManager/issues/199#issuecomment-344443456, or mute the thread https://github.com/notifications/unsubscribe-auth/AAbT_Wf8ik-hUUIky7jSrHIO8nSwk49dks5s2ix3gaJpZM4QBJbR .
michaco is right. running locally it runs quickly, and yes i do see the two get operations, which was in there as a relic from the real code.
so it looks like the only issue is network latency. obviously one can't expect to run redis on the same webservers so we will make efforts to get it as close to them as possible.
thanks for looking.
Ok, there seem to be no problem with CacheManager. /closing
i've got redis running in our internal network. using cachemanager is causing the round trip of the page to exceed 100+ seconds vs the normal 2-5 seconds.
what should i be looking at to help debug the issue?
i'm using Ninject for DI and instantiating the ICacheManager object in a singleton scope, so i don't think it's having to re-open the connection over and over - which has been an issue with other third party systems (like Elasticsearch).
here's how i'm configuring the cache...
cacheConfig = ConfigurationBuilder.BuildConfiguration("memandrediscache", settings => { settings .WithSystemWebCacheHandle("inProcessCache") //.EnableStatistics() .And .WithRedisConfiguration(redisKey, config => config .WithAllowAdmin() .WithConnectionTimeout(1000) .WithEndpoint(endPointUrl, endPointPort) .WithPassword(password) //.WithSsl() ) .WithGzJsonSerializer() .WithJsonSerializer(jsonSer, jsonDeSer) .WithMaxRetries(10) //from 1000 .WithRetryTimeout(100) .WithRedisBackplane(redisKey) .WithRedisCacheHandle(redisKey, true); });