Users online dropped after Memcache(d) installation

Started by spiros, May 05, 2020, 10:38:47 PM

Previous topic - Next topic

spiros

I saw the number of users displayed online drop dramatically after installing Memcache(d). Is there any explanation for this?

Also, when I run a gtmetrix site analysis it shows only 2 file requests being made:

index.php
favicon.ico

And an amazingly high score PageSpeed Score (100%), YSlow Score (100%), Fully Loaded Time
0.8s, Total Page Size 1.19KB

Arantor

What exactly did you configure memcache to do? Caching, sessions, both?

spiros

I did not make any configurations apart from installation. On SMF I get the message that I have Memcached installed (SMF has detected that your server has Memcached installed.).

I installed via:

yum install ea-php72-php-memcache
yum install ea-php72-php-memcached



On the server, I get this:

service memcached status
memcached.service - Memcached
   Loaded: loaded (/usr/lib/systemd/system/memcached.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Thu 2020-05-07 21:45:41 EEST; 29min ago
Main PID: 7556 (code=exited, status=64)

May 07 21:45:41 host.translatum.gr systemd[1]: Started Memcached.
May 07 21:45:41 host.translatum.gr memcached[7556]: Cannot set item size limit higher than 1/2 of memory max.
May 07 21:45:41 host.translatum.gr systemd[1]: memcached.service: main process exited, code=exited, status=64/n/a
May 07 21:45:41 host.translatum.gr systemd[1]: Unit memcached.service entered failed state.
May 07 21:45:41 host.translatum.gr systemd[1]: memcached.service failed.

Arantor

If I had to guess I'd suggest that installing memcache told PHP to use memcache for sessions, and memcache has failed to load so sessions don't work properly any more.

The configuration of memcache needs changing, it's set to use too much memory.

spiros

Thanks so much Arantor, I would say that you have been one of the most helpful and knowledgeable person I ever had feedback from on any forum, truly extraordinary!

So that means that most user do not have access to the site, while some do? How can this be possible?

Arantor

If they were already logged in and set to 'forever' or their cookie is still good, they'll still have access because their session will be recreated each time from the cookie. (Not ideal but not unexpected.)

Guests also inherently won't have a problem, because they'll just cycle sessions over time and no harm no foul.

The part that's problematic is people who are trying to log in - depending on *exactly* what's gone on, they may or may not be able to log in because the session might not be saved so when they try to log in the second time, their session won't match.

If you can get memcache running, great, because memcache will handle sessions more efficiently than PHP or the database ever would normally, but you need it not to try to consume too much memory first :)

Failing that, you can force SMF to use database sessions and it should ignore memcache for that.

spiros

I had CACHESIZE="1GB" in /etc/sysconfig/memcached
Changing that to CACHESIZE="64" fixed it.

Arantor


drewactual

great catch!!!

i have mine set to 1024, but i'm on a dedicated... it hasn't crashed me..

the reason why i'm typing this, though, is that memcached (unless set properly) will not self initiate upon restart.. there is a little script/cron i can dig up if you'd like that will ensure it gets started when the server restarts... 

spiros

I guess this does the job (at least in CentOS 7), what OS you have?
systemctl enable memcached

drewactual

same, and yes. that is it. 

i used to allow the server to reboot auto when updates were posted- and while doing so memcache wouldn't initiate.. which means folks couldn't post... and it may be seconds, minutes, or hours before i'd catch it.  no bueno.

also, in httpd.conf, the settings expected are 'un-commented' and altered to my specs, which it sounds like you've already adjusted... curious, though, as out of the box memcache(d) is 64megs, no?  how did it get to 1024?  just curious....

spiros

I did it, out of my ignorance apparently, hoping to increase performance, rather than decrease it :)

drewactual

easy enough a mistake to make... good you're on it!!!

Advertisement: