开发者

Multiple instances of memcache?

开发者 https://www.devze.com 2023-01-23 13:33 出处:网络
I have cho开发者_如何转开发sen to store my sessions in memcache, which is working well.... recently we have had too many active users... so we had to limit the number using our app. To achieve this I

I have cho开发者_如何转开发sen to store my sessions in memcache, which is working well.... recently we have had too many active users... so we had to limit the number using our app. To achieve this I use

$memcache->getStats(); and based on the number of ['curr_items'] I let the user into the app or not.

Problem is I now realised I would like to use memcache to store some frequently run queries.... this would obviously break my method of counting the active sessions... so can I run multiple memcache instances... one for sessions, one for everything else.... is there a disadvantage to doing so?


You can run different Memcache instances on different ports and use them for any purpose you want. There's very little performance overhead in juggling multiple Memcache instances. Just instantiate another Memcache object with different connection parameters.

It seems, however, that you're using a pretty odd method of counting and restricting your users. If you use Memcache more heavily and in the right places, you'll be able to support a lot more active users. That's the proper way to use Memcache, after all.


I have chosen to store my sessions in memcache

...

$memcache->getStats(); and based on the number of ['curr_items'] I let the user into the app or not.

Why don't you just sort out the reasons which made you choose memcached for session storage and use a more scalable substrate for your sessions?

0

精彩评论

暂无评论...
验证码 换一张
取 消