littlebizzy / slickstack

Lightning-fast WordPress on Nginx
https://slickstack.io
GNU General Public License v3.0
624 stars 113 forks source link

MySQL and/or Redis crashing sometimes on Ubuntu 20.04 #183

Closed jessuppi closed 1 year ago

jessuppi commented 1 year ago

A few days ago, a member of our Discord mentioned his SlickStack server was sometimes crashing where it seemed like the MySQL database was simply not working properly until he rebooted the machine.

Shortly afterwards, a client contacted me who is running a 20.04 server also, claiming the site was down... there was also a laundry list of Redis object cache errors in the log.

I'm not sure what is causing MySQL problems on Ubuntu 20.04 for SlickStack servers. Most of us have moved on already to focusing on Ubuntu 22.04 which has been the most stable stack for us yet. But for documentation purposes I'm opening this Issue and hopefully we eventually are able to figure this out...

Ref: https://github.com/littlebizzy/slickstack/issues/182

hj-collab commented 1 year ago

Not sure if this is a redis issue and not enough info to debug but Redis is a complex beast. You can try something simpler like memcached. Redis is not suitable for your stack also. It's recommended to use when you can run multiple instances of redis to bypass it's single threaded nature. Memcached have fewer features but is suitable for most wp sites and can also take benefit of more cores due to multi threaded nature. Wordpress VIP also uses memcached but in multiple clusters. https://docs.wpvip.com/technical-references/caching/object-cache/

jessuppi commented 1 year ago

Thanks @hj-collab

We have discussed Memcached a few times in fact, as I've always felt Redis is too complicated. Most people using SlickStack are running lowend boxes, with the occasional high-traffic site. Regardless of CPU threads, if talking about support for load balancing and clusters, do you think Memcached is better for us all around?

hj-collab commented 1 year ago

@jessuppi Yes, Memcached is better than Redis for low and high traffic sites. People go with redis as it has much larger featureset compared to Redis. But wordpress sites don't need such features until you are running a lot of custom code and some bypassing WP structure. My memcached config file is less than 10 lines in total. An average redis config file is much bigger due to so many features they provide.

jessuppi commented 1 year ago

I'm probably not going to invest time into figuring out why Redis is having occassional issues on Ubuntu 20.04 and will be closing this Issue for now, future comments are welcome.

We are going to proceed with shifting to Memcached, I see Roots Trellis is also using it.

It seems Memcached config/security options have improved in the last few years with more options than before, so that is also encouraging, it was "too" basic before.... I guess a few bad news stories helped push it forward.

@hj-collab if you're willing to comment on our default config, thanks!

https://github.com/littlebizzy/slickstack/blob/master/modules/memcached/memcached-conf.txt