1

I have a Linux Ubuntu virtual server at Digital Ocean with the following specs: 1 vCPU, 2GB of memory, and 25GB of SSD storage.

The server is running a single WordPress website with around 400 unique visitors per day. A caching plugin has been installed and configured. Redis is also installed and configured on the server.

I have setup a memory usage notice in the control panel of Digital Ocean and I am being notified multiples times a day that the server has crossed the 70% threshold for usage.

When I run htop in the terminal, MEM is being shown as using 1.2GB to 1.4GB of 1.92GB at any given moment. SWAP is shown to be using 39.2MB of 2.00GB.

When I view the peak memory usage in the Query Monitor plugin installed in WordPress, it shows only 3.2% of 768 MB server limit being used. I have defined the PHP memory limit to be 768MB in the WordPress configuration file. These numbers seem to run in contrast to what the server is telling me related to memory usage on the server.

In my server's my.cnf, I have the following parameters set:

  • performance_schema = off
  • innodb_buffer_pool_size = 512M
  • key_buffer_size = 64M
  • max_connections = 400

Can anyone suggest where the memory hogging me be taking place on the server?

15
  • 2
    Why should 30% of your memory remain unused? Your memory is there to be used. linuxatemyram.com
    – HBruijn
    Jul 26 at 20:01
  • Questions on Server Fault must be about managing information technology systems in a business environment. Home and end-user computing questions may be asked on Super User, and questions about development, testing and development tools may be asked on Stack Overflow. Jul 26 at 20:07
  • Your config and metrics are all over the place. What "server limit"? What have you done to analyze the usage? How exactly did you php's memory limit?
    – symcbean
    Jul 26 at 20:39
  • What version of MySQL?
    – Rick James
    Jul 27 at 1:00
  • @RickJames The server is running MySQL 8.0.33 Jul 27 at 15:26

1 Answer 1

2
  • SHOW STATUS LIKE 'Max_used_connections'; -- It will probably say much less than the 400 allocated; lower max_connections to, say, 30.

  • You should not be using MyISAM; lower `key_buffer_size to 20M

  • Remove the caching; you probably don't have enough activity to warrant the extra cache layers. Anyway, the buffer_pool does most of the work. This, on the other hand, improves the indexes to improve performance. It takes very little RAM: WP Index Improvements

  • "PHP memory limit to be 768MB" -- That seems extremely high. Also it is per connection. Lower it to, say, 100MB. If PHP crashes, then let's look at simplifying the webpage that caused the crash.

  • If you still have memory troubles, lower innodb_buffer_pool_size.

8
  • 1
    @Mike-Hermary If you still need assistance, please let us know. Jul 27 at 13:57
  • @RickJames The WordPress tables are mostly using the InnoDB schema. A couple of tables are using MyISAM. I have implemented the other suggestions. Now when I navigate to some pages, a database connection error is displayed intermittently. Jul 27 at 15:58
  • A couple of your tables are MyISAM? Consider converting them.
    – Rick James
    Jul 27 at 16:01
  • @RickJames Can I convert them safely with MySQL in the terminal via SSH? Jul 27 at 16:55
  • 1
    @RickJames Thanks! I used a plugin to successfully change the engine for the few tables in WordPress. Jul 28 at 17:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .