I’m an artist and have a small website with a wordpress installation with a few static pages, and for a long time I’ve had issues with the website crashing from running out of memory. I’ve run mySQLtuner loads of times and eventually exhausted all the setting options it told me, but my website still crashes. Sometimes it goes a few weeks without crashing, others it crashes most days, like this week.
I’m on the smallest droplet with 1GB memory, and a lot of articles I see on troubleshooting say to just upgrade the server size. I don’t much fancy having to pay double the hosting costs without being sure it’s necessary. So I wanted to ask from people who know better. Is 1GB really not enough for a dinky website like mine? There’s like nothing on it, and I have Redis object cashing enabled.
Are there things I could try to possibly fix this? I’ve been holding off on asking for help for so long, but it’s gotten to be such a pain. :\
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Sign up for Infrastructure as a Newsletter.
Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Heya,
It can be frustrating when your website keeps crashing due to memory issues, but there are several potential reasons for this, and it’s worth exploring some solutions before jumping to a more expensive hosting plan. While 1GB of memory is on the lower side, it should still be sufficient for a small WordPress website if it’s properly optimized.
Here are some steps to consider:
Caching: You mentioned that you have Redis object caching enabled, which is good. Consider using a full-page caching plugin like W3 Total Cache or WP Super Cache to reduce server load.
Minimize Plugins: Evaluate the plugins you have installed and deactivate or remove any unnecessary ones. Some plugins can be resource-intensive.
Analyze your website’s resource usage. You can use tools like New Relic, Query Monitor, or P3 Profiler to identify resource-hungry plugins or themes.
Monitor server resource usage with tools like
top
,htop
, or the server’s monitoring dashboard to see if a specific process is causing the high memory usage.If you’ve tried all of these and still experience memory issues, it might be worth considering upgrading your hosting plan.
Remember to take regular backups of your site before making any significant changes, and implement changes gradually, monitoring the performance impact as you go. This way, you can identify which optimizations are most effective for your specific case.
Hope that this helps!
Heya,
Before going for an update, you might want to try and optimize both your Droplet and your Website. Here are some general tips to do so:
Let’s start with Server Optimization.
When looking at Server/Droplet Optimization, there are a few necessary services/packages that are universal.
The first one would be Server-side caching. Server cache is an umbrella term covering a number of different types of caching. This includes Content Delivery Network (CDN) caching, object caching, and opcode caching. Depending on what you want to achieve you might need one or the other. Usually, though, you can have all 3 types of caching as it shouldn’t interfere with your Website/App. I won’t go into more details about what each caching does as this post will become 3 pages long. There are multiple documents providing services/packages for each of the server-type caching.
Next would be using PHP-FPM (if your Website is using PHP of course). PHP-FPM is an efficient method on how to minimize the memory consumption and rise the performance for the Websites with heavy traffic. It is significantly faster than traditional CGI-based methods in multi-user PHP environments.
Another solution would be Database Caching. A database cache supplements your primary database by removing unnecessary pressure on it, typically in the form of frequently accessed read data. The cache itself can live in a number of areas including your database, application or as a standalone layer. Usually, for this kind of caching is being used Redis.
Apache NPM modules. If you are using Apache, you are using one of three NPM modules. Most certainly if you haven’t configured anything on it and have used the default configuration, you are using NPM_Prefrok which is the most outdated one and thus the slower. I’ll recommend using one of the other two - NPM_Worker and NPM_Event depending on your situation. Again, I would urge you to read more about these 3 and what is applied in which case.
Apache Workers. Basically, the Apache workers are equivalent to a room full of seats. These seats are the projection to your website. When someone opens your website, it’s like one person going to this room and sitting on one of the chairs. When the limit is reached, in order for a person to load your website, another one needs to close it. So basically, I’ll suggest increasing that value as well.
Those were the basic optimizations on a server level, let’s start with your Website/App
Since you are using WordPress, there will be plugins/addons. These addons can be very powerful if used correctly. The most helpful plugins are:
Usually, Websites/Apps are slow because of a couple of reasons which range from too many requests or big images to a bunch of unnecessarily big JS or CSS files. Optimizing these whether you are using a Plugin or doing it manually is enough.
Hope this helps!