phoenixweb

Well-Known Member
Jun 3, 2004
70
0
156
cPanel Access Level
DataCenter Provider
Dear all,

i would like to know what the community think about these optimizations.

Environment: VPS with iSCSI disks

1) NO SWAP PARTITION
Rational: when linux/cpanal start to swapping most of the time the system is already unstable, moving memory from/to disk continuosly doesn't help the system, just hung apache/mysql

2) LOWERING BLOCK SIZE FROM 4Kb TO 1Kb
Rational: on CentOS the default block size is 4Kb, this allow faster seeking time on the fs (ext4) than others.
However on systems with tons of small file (like email files, html files) that are lower than <1Kb this can mean lose up to 30%, 40% of the available disk space by using more than double of the necessary space to store the file.
Lowering the block size can mean doubling your available space.
On the other side you can get more limitation in filesystem dimension which are fine for me.
Block size Maximumfile size Maximumfile system size
1 KiB 16 GiB 2 TiB
2 KiB 256 GiB 8 TiB
4 KiB 2 TiB 16 TiB
8 KiB 2 TiB 32 TiB

3) ANY OTHER SUGGESTION?

All hints are more than welcome!
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,268
463
Hello :)

I found the following external resource that discuses disabling SWAP on Linux:

Completely Disable SWAP

While it's not directly related to a web hosting environment, it may have information that is useful to you.

Thank you.
 

phoenixweb

Well-Known Member
Jun 3, 2004
70
0
156
cPanel Access Level
DataCenter Provider
Thank you Micheal! :)

I already know how to act to disable swap and change block size on FS (thanks to google of course).
But I'll like to know if somebody have tried to tuning its server.
What are its experiences, suggestion and reccomandation ;)

Probably the most important contribute can be given by the cPanel developers.
I see from documentation:

Step 5: Configure Your Operating System
Advanced Options: Pre-Installation

that cPanel state:
Note: All of the following partitions are optional except / and swap.
Is Swap mandatory in order to make cPanel works?
Swap is RAM, then should not be mandatory if there is enought RAM.
Can cPanel staff confirm this?
 

ThinIce

Well-Known Member
Apr 27, 2006
352
9
168
Disillusioned in England
cPanel Access Level
Root Administrator
For whatever it's worth to you I've run into issues with java on vms without full access to swap in the past, this may or may not be relevant to you, this as well as other things is discussed at

linux - How much SWAP space on a high memory system? - Server Fault

The java issue taught me that there is an issue of unintended consequences here, if software has been tested in the majority of cases where swap is available, it's abscene can lead to odd happenings in a minority of cases :)

The other thing I'd highlight is In the case of a runaway memory event, do you want a window (which swap will give you) to resolve the issue before processes are killed? The discussion linked above refers to the old chestnut of addressing firefox running away with ram on a desktop, which is a bit different from what you want to happen on a server
 
Last edited:

phoenixweb

Well-Known Member
Jun 3, 2004
70
0
156
cPanel Access Level
DataCenter Provider
Thank you ThinIce,

I already read many comment PRO and CONS to SWAP.
But i didn't found any discussion related strictly to servers.
As far as i know:
- there is no need to hybernate or suspend a server
- desktop can run out of memory, freeze applications avoiding further input from the human, and turn back alive 10 second later, server and daemons running cannot.
- swapping is much resource consuming which is translated in a high response time, having an high response time means making the queue of the request larger and larger till the server start to hang and began to kill the process

What about the issue you experience in the past as you mentioned?
What about the experience of cPanel in this kind of test?
 
Thread starter Similar threads Forum Replies Date
C Workarounds and Optimization 1