Thunderchild

Well-Known Member
Jan 28, 2018
77
3
8
UK
cPanel Access Level
Root Administrator
I have a server with 4 cores, 100 GB SSD and 2 GB of RAM. clamd keeps crashing and on a couple of occasions the domain server too. is 2GB enough? I have 7 sites active. My provider expects me to upgrade the whole server giving me 6 processors and 150GB SSD to get a further 2GB of RAM, I only use 15 GB of SSD and 0.2% of processor currently.
 

Thunderchild

Well-Known Member
Jan 28, 2018
77
3
8
UK
cPanel Access Level
Root Administrator
I don't know when I am at peak usage, usually it clamd crashes overnight. I am just trying to get a feel for what is typical, is it something I have done wrong/not done or is 2GB a bit low? I have lowered the allowed RAM for each script from 128MB to 96MB and clamd crashes less often but still crashes.
 

JayFromEpic

Well-Known Member
Apr 2, 2011
218
8
68
Scottsdale
cPanel Access Level
Root Administrator
Twitter
While 2GB of ram is a modest amount, most servers now a days are running 8gb+. It's impossible to know exactly what is needed if you have no clue on just hoe much ram each of your websites are using. What have you done so far to optimize your server?

Additionally, if you are unsure and budget is a concern, you may want to look into moving to a vps that can be scaled as needed or into a cloud instance which would allow the same.
 

Thunderchild

Well-Known Member
Jan 28, 2018
77
3
8
UK
cPanel Access Level
Root Administrator
Well clearly more than 64MB each but less than 96MB. I have now upgraded to PHP7.x and it's default setting was 32MB and websites ran on that. clamd seems to require 500MB as it reports usiing 26% of RAM, why WHM can't just give me the total RAM used I don't know as it tracks eacch individual process....

I am currently paying £45, they want £60 to get 4GB of RAM of course with 2 more unneeded processors and another 50GB of SSD. I see other providers that offer custom jobs where I can get 3-4GB of RAM with 2 cores and 30GB SSD for much less than I currently pay. Of coulse i have the moving headache once again.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,911
2,234
363
Hello @Thunderchild,

The following resource is a good place to start when troubleshooting high amounts of resource usage:

Tutorial - Troubleshooting high server loads on Linux servers

As far as ClamAV failing, do you notice any output in /var/log/exim_mainlog or /var/log/messages at the times it's reported to have failed that suggest a lack of available memory is the culprit?

Thank you.
 

sparek-3

Well-Known Member
Aug 10, 2002
1,929
178
343
cPanel Access Level
Root Administrator
Is the VPS KVM or Xen based?

Since the hard drive space is SSD, you could create a swap file and use it for swap memory.

With SSD swap space, you're probably not going to notice a lot of performance issues related to swap space memory issues. After all, SSD is essentially just non-volatile memory.

I'm not saying it will give you the same performance as pure memory, and a lot of it would depend on just how much disk I/O you have for the SSD drives (no doubt they are shared among other virtual environments). And this won't work in an OpenVZ or Virtuozzo environment.
 

Thunderchild

Well-Known Member
Jan 28, 2018
77
3
8
UK
cPanel Access Level
Root Administrator
I have tried setting up swap space but it did not work on a reboot even though I followed all of the steps. I have tried to set it up again without success. I get emails from the server stating that clamd was terminated due to a lack of RAM.

adding and switching to PHP7 seems to have made quite a difference as sites that previously used 64-96MB now use under 32MB
 
Last edited:

sparek-3

Well-Known Member
Aug 10, 2002
1,929
178
343
cPanel Access Level
Root Administrator
To make an extra swap file on the server:

dd if=/dev/zero of=/extraswap bs=1M count=4096
mkswap /extraswap
swapon /extraswap


This will create an extra 4GB of swap memory on the server. Again, this will only work on KVM and Xen (actually I'm not sure about Xen). Adjust the count variable as needed, although I probably wouldn't go crazy with this. If you need more than 4GB, then you're probably doing something wrong.

Then edit the /etc/fstab file (is this still relevant in CentOS/RHEL 7?) with:

/extraswap none swap sw 0 0

That should make it persistent.

This may not help, but it's certainly something I'd try, it won't cost you anything.
 

sparek-3

Well-Known Member
Aug 10, 2002
1,929
178
343
cPanel Access Level
Root Administrator
KVM and Xen are virtualization technologies. I am assuming (given the low memory) that you have a VPS and not a full dedicated server. So the server you have is using some type of virtualization. OpenVZ and Virtuozzo are other popular "virtualizations" (they're not real virtualizations, but that's an argument for another day). I'm sure there are other virtualization technologies out there, but these are the ones that I am familiar with.

Change the permissions on the extraswap file before issuing the swapon command

chmod 600 /extraswap
 

Thunderchild

Well-Known Member
Jan 28, 2018
77
3
8
UK
cPanel Access Level
Root Administrator
I have found something called Munin in my plugins section, this seem to give various graphs for various aspects of the sever one being RAM, i take it i can use this as a measure of what i am using and to help understand what i may need if i want to increase the amount of accounts on the sever?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,911
2,234
363
I have found something called Munin in my plugins section, this seem to give various graphs for various aspects of the sever one being RAM, i take it i can use this as a measure of what i am using and to help understand what i may need if i want to increase the amount of accounts on the sever?
Hello,

Any type of plugin (e.g. Munin) that monitors and reports resource usage will help you to better form an understanding of how your system is performing. Here's a third-party URL related to Munin and RAM usage you may find helpful:

Interpreting munin graph and committed memory

Thank you.