Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
cheresources Posted February 10, 2011 Posted February 10, 2011 I've got memcache installed on my server and the config file all set up. Now, I a couple of questions: 1. I believe memcache is working, but since I upgraded servers at the same time, I'm not sure if the speed up is the server or memcache or both. I have root access to the server. How can I tell if memcache is working properly on the server? 2. If I need to change, say a blog template, do I need to disable memcache, make changes, then re-enable memcache? I've been trying to make some template changes, but they're not appearing on the production side and I'm thinking that memcache may have something to do with this. Thanks,
Gary. Posted February 12, 2011 Posted February 12, 2011 Hello, You can try the below but I only assume memcached server installed; There are two modules that need for memcache to function, The memcached server and The php-pecl-memcache module If you have then just do the following :) testmemcached.php - So the contents of that file will be: <? phpinfo(); ?> Now visit the link via your website: http://YOUR-DOMAIN.COM/testmemcached.php and if the module is ready you will get somewhere in the results an image like below: If so, Contune, If not then you done something wrong.... Make yet again another php file, And call it something like: testmemcache1.php and make the contents show: <?php /* procedural API */ /* connect to memcached server */ $memcache_obj = memcache_connect('localhost', 11211); /* set value of item with key 'var_key' using 0 as flag value, compression is not used expire time is 30 seconds */ memcache_set($memcache_obj, 'var_key', 'some variable', 0, 30); echo memcache_get($memcache_obj, 'var_key'); ?> Now save, Upload and visit that website with the path to the file, Now it will show "some variable" if not and memcached is not done right, It will chuck out a page of errors roughly like:Memcache::connect() [function.Memcache-connect]: Can
Solo Drakban Posted February 15, 2011 Posted February 15, 2011 Telnet to the memcache server (telnet localhost 11211 for example) and type 'stats' and you'll see a bunch of information. Look at the STAT cmd_get and STAT cmd_set lines. Type 'stat' again and see if the counters increased. If so, it's working, congratulations. If not, then see the post above for determining if memcache is configured properly. memcache + IPB = awesomeness BTW. The load it takes off the DB makes it well worth it.
Gary. Posted February 15, 2011 Posted February 15, 2011 You use telnet :o :o :o I honestly hope you do not host anyone, You will put them at a MASSIVE RISK
Solo Drakban Posted February 15, 2011 Posted February 15, 2011 You use telnet :o :o :o I honestly hope you do not host anyone, You will put them at a MASSIVE RISK Uh, what? The telnet client != a telnet server. A telnet client is very useful for doing text-based protocol debugging such as memcache, HTTP, etc. A telnet server shouldn't be installed.
Guest Posted February 15, 2011 Posted February 15, 2011 Uh, what? The telnet client != a telnet server. A telnet client is very useful for doing text-based protocol debugging such as memcache, HTTP, etc. A telnet server shouldn't be installed. What he said. :)
cheresources Posted February 16, 2011 Author Posted February 16, 2011 Thanks for the help. I've managed to confirm that the memcache seems to be working, but the actual cache used is tiny (163 KB) on a board with over 20,000 posts. This seems tiny considering it's been up for 5 weeks. Does memcache simply store text from the database? Does this sound reasonable?
Solo Drakban Posted February 16, 2011 Posted February 16, 2011 Thanks for the help. I've managed to confirm that the memcache seems to be working, but the actual cache used is tiny (163 KB) on a board with over 20,000 posts. This seems tiny considering it's been up for 5 weeks. Does memcache simply store text from the database? Does this sound reasonable? memcache contents are gzip'd on the fly into memory so container storage can be low. I'm not 100% sure how IPB does caching but every object more than likely has an expiration time. Threads (or other things) not accessed frequently will be expired from cache to save memory. They probably aren't just storing the text content either but a serialized object representing all of the data for the post (poster information, body, parsed BBcode, etc), though again, I can't speak to what IPB is doing in the background, though it makes the most sense (so probably not ;)) The biggest thing to judge if the cache is effect or not is the get_hits and get_misses counters. For example on my memcache: STAT cmd_get 33424549 STAT get_hits 33414478 STAT get_misses 10071 So the cache is achieving a 99.97% hit rate (very excellent). If your cache is hitting I'd say 70% or lower over that 5 week period and you might want to dig deeper. The other thing to look at (if you monitor it) is the QPS (queries per second) rate to your database. I've found that the IPB memcache is extremely effective in reducing overall queries to the database so if you've seen a dramatic drop of traffic to your DB server and/or a drop in the over QPS rate then I'd say it's working.
Gary. Posted February 16, 2011 Posted February 16, 2011 telnet client != a telnet server. A telnet client is very useful for doing text-based protocol debugging such as memcache, HTTP, etc. A telnet server shouldn't be installed. Disable completly, Even a novice would feel over powered using it !
Cap'n Refsmmat Posted February 17, 2011 Posted February 17, 2011 memcache contents are gzip'd on the fly into memory so container storage can be low. I'm not 100% sure how IPB does caching but every object more than likely has an expiration time. Threads (or other things) not accessed frequently will be expired from cache to save memory. They probably aren't just storing the text content either but a serialized object representing all of the data for the post (poster information, body, parsed BBcode, etc), though again, I can't speak to what IPB is doing in the background, though it makes the most sense (so probably not ;)) I don't think IPB memcaches individual posts; that's done in the content_cache_posts table in MySQL. IMHO IPB really ought to cache more stuff in RAM, since it's really not taking advantage of the speed available to it. Disable completly, Even a novice would feel over powered using it ! Why? He's using it on his own computer, not on the server. I use telnet routinely for debugging SMTP servers -- you can telnet to port 25 and talk to the email server like you're a mail client.
Gary. Posted February 18, 2011 Posted February 18, 2011 I've got memcache installed on my server and the config file all set up Why? He's using it on his own computer. I must be going blind, If he said own computer, I can only guess he would have said, "I've got memcache installed on my local host"
Cap'n Refsmmat Posted February 18, 2011 Posted February 18, 2011 I must be going blind, If he said own computer, I can only guess he would have said, "I've got memcache installed on my local host" You quoted him talking about telnet, not memcached. You can use telnet to talk to a memcached daemon just like you can use it to talk to a SMTP server or a HTTP server.
Gary. Posted February 18, 2011 Posted February 18, 2011 It's a memcached thread, Anyway I'm not going to argue over thge net ! Were both here to help thats all. I agree with you, Yes you can telnet but I would only use it localhost, Not in a server or webhost enviroment.
cheresources Posted February 18, 2011 Author Posted February 18, 2011 I'm starting to feel responsible for this feud :) . I don't use telnet, so there's no issue there. My miss rate is 0.9% which sounds pretty good. Thanks for your help gentleman!
Recommended Posts
Archived
This topic is now archived and is closed to further replies.