Hi,
I added memchached to my website. And site started running very slow. If I cancel memchached ,application backs to work quickly.
Why is this happening?And how to avoid it?
Thanks, kukuwka
Hi,
I added memchached to my website. And site started running very slow. If I cancel memchached ,application backs to work quickly.
Why is this happening?And how to avoid it?
Thanks, kukuwka
That is impossible to answer without knowing how you are using it and what data you are storing. For example, if you are using it as the HttpCache
provider (if you are using ASP.NET), and you were previously using the in-process cache provider, then it will behave very differently; the in-process provider has no serialization or network costs, so you might be storing some insanely large objects in the cache. That is fine when it is in-process, but for any other provider this is very very bad; you will have to transfer and deserialize for every usage (and serialize and transfer for every storage).
There are ways to improve the serialization/deserialization/network times, but it sounds like you are simply storing too much data (or inappropriate data) in the cache at the moment. I'd address that first, and then look at tuning it.
Memcached doesn't mean "make things faster." It provides fast and very scalable access to a shared cache of something that is otherwise expensive to acquire.
If you add caching to something that's cheap, it may end up being slower.
For example, if it takes you five seconds to do something and you can cache that, then you'll save almost five seconds on each subsequent request assuming the results are still useful.
If it takes you a few nanoseconds to do it, then it'll slow you down considerably to fetch the results over the network.