|
When your Control Panel works slow or you have high CPU/memory load,
there could be certain ways to accelerate the Control Panel performance.
H-Sphere Java-Related Issues
1. Apache JServ Configuration (before v.2.4)
The following procedure is performed once to set parameters that
depend on the server memory size.
1. Stop the Control Panel.
2. Update the jserv.properties file:
vi /hsphere/local/home/cpanel/apache/etc/jserv/jserv.properties
For example, for a server with 512 MB RAM the following parameters should be set:
wrapper.bin.parameters=-Xms64M -Xmx512M
3. Start the Control Panel.
2. NFU Cache Optimization
NFU cache parameters have to be set depending on your server memory size and the number
of accounts and domains in your system. If a lot of new accounts/domains
are added to H-Sphere, we recommend to reconfigure NFU cache as follows:
1. Stop the Control Panel.
2. Set NFU parameters in hsphere.properties.
Check hsphere.log for NFU messages:
grep NFU /var/log/hsphere/hsphere.log
You would receive the lines like these:
2003-02-26 08:08:29,190 [Thread-11] DEBUG psoft.hsphere.CP - Resource NFU cache:initial size:5000 size:142 max size:5000 rate:0.0
2003-02-26 08:08:29,190 [Thread-11] DEBUG psoft.hsphere.CP - ResourceId NFU cache:initial size:25000 size:161 max size:25000 rate:0.87
2003-02-26 08:08:29,190 [Thread-11] DEBUG psoft.hsphere.CP - SharedObject NFU cache:initial size:5000 size:0 max size:5000 rate:0.0
Here, you should pay attention to the "size" and "rate" parameters.
If the "initial size" is close to the "max size" and rate is lower than 0.75,
it is appropriate to increase the size of NFU cache.
For this, you need to insert two parameters to hsphere.properties:
NFU_CACHE_MULTIPLIER = 5
NFU_CACHE_MULTIPLIER_MAX = 10
In this example, cache size would increase five times, and if necessary (e.g., for accounting)
it could be increased ten times.
3. Start the Control Panel.
H-Sphere System Database Optimization
H-Sphere Database Settings
1. Converting Bigint to Int4
Skip this procedure if you have performed the Postgres
upgrade to 7.3 version.
Postgres migration from int8 to int4 is very effective
if you host more than 500 accounts.
(By default, Postgres can't index fields of the int8 type.)
You need to perform it once at any time.
For this procedure, find the partition with sufficient amount of free space.
1. Stop the Control Panel (check hsphere.log that no crons are running)
2. Export schema:
pg_dump -u -s -f db_old.db hsphere
chmod 600 db_old.db
cp db_old.db db.db
Note: dump file is created with 644 permissions by default;
you need to set more secure 600 permissions
to prevent the data from being read by other users.
3. Convert int8 to int4:
vi db.db
In vi editor, change every instances of bigint and int8 to int4 by typing the following commands:
%s/bigint/int4/g
%s/int8/int4/g
4. Then, still editing db.db in vi,
change type back to int8 for the ip_num column in the l_server_ips table and its index.
a) find the ip_num definition in the CREATE TABLE "l_server_ips" ( ... ); command:
ip_num int4 NOT NULL
- and change int4 to int8;
b) find the index creation command:
CREATE INDEX "l_server_ips_numkey" on "l_server_ips" using btree ( "ip_num" "int4_ops" );
- and change int4_ops to int8_ops.
5. Export Data:
pg_dump -u -a -f data.db hsphere
chmod 600 data.db
Note: dump file is created with 644 permissions by default;
you need to set more secure 600 permissions
to prevent the data from being read by other users.
6. Recreate DB:
dropdb -U wwwuser hsphere
createdb -U wwwuser hsphere
7. Create Schema:
psql -q -U wwwuser -f db.db hsphere
8. Import Data *:
psql -q -U wwwuser -f data.db hsphere
9. Start the Control Panel.
2. Updating Moddb (for H-Sphere versions 2.3 RC4 and higher)
Moddb is one of the scripts included in the H-Sphere update. However, it is not automatically performed
during the H-Sphere installation. You should launch it manually and only once. To do this:
Note: Prior to running moddb, update your H-Sphere to the latest version.
1. Stop the Control Panel.
2. Make moddb:
- Download the H-Sphere 2.3 update
(to the version you have installed)
- Run the update script:
#sh ./U23P3 (H-Sphere version 2.3 Patch 3 update script)
- choose moddb.
This option will back up old H-Sphere database and modify H-Sphere DB scheme
(increase some fields length, e.g: email, notes, suspend/resume reason etc).
Note: You may be prompted for your H-Sphere DB password under Postgres
versions starting from 7.2.x.
Enter the password to complete the procedure.
3. Start the Control Panel.
Postgres System Settings
1. Performing VACUUM
VACUUM should be performed regularly (e.g., once a week).
You may put the corresponding script into cron.
Mind, however, that this procedure requires a lot of system resources and creates a high server load.
We recommend you to back up the database before performing vacuumdb. Be careful: if the server gets down
during this process, some data may be lost!
To backup your system database, run the hs_bck script:
/hsphere/shared/scripts/cron/hs_bck, or
cd /hsphere/shared/backup ./hs_bck
Do the following procedure to apply VACUUM to your system:
- Log into the server as root:
su - postgres (or su - pgsql for FreeBSD)
- Connect to the database:
psql -U wwwuser -d hsphere
- Do vacuum:
hsphere$ vacuum full;
(or vacuum analyze;, or vacuum;, depending on
the PostgreSQL server version)
Note: vacuum is a time-consuming procedure; it may take up to several hours to complete!
2. Optimizing Postgres Memory Usage
You may increase memory resources used for Postgres by modifying the
sort_mem and shared_buffers parameters in the
postgresql.conf file.
1. Stop the Control Panel.
2. Stop Postgres.
3. Modify the postgresql.conf file:
su - postgres (su - psql in FreeBSD)
cd data
vi postgresql.conf
You would get the line similar to these (values are in kilobytes):
sort_mem = 32168
shared_buffers = 65536
Increase the size of memory used by the PostgreSQL server according to the PostgreSQL documentation.
4. Start Postgres and make sure it's working properly. If parameters are incorrect,
Postgres might not start. In this case, please also set the SHMALL and SHMMAX
kernel parameters according to the rules described in the
RedHat
documentation.
5. Start the Control Panel.
3. Upgrading Postgres to the Latest Version
See Upgrading System Database.
Troubleshooting
Sometimes while importing data you may get the message like this:
----------------------------------
psql:data.db:527111: ERROR: copy: line 422025, Bad float8 input format -- underflow
psql:data.db:527111: PQendcopy: resetting connection
----------------------------------
This means that Postgres can't interpret data it has just exported.
You need to open the data.db file:
vi data.db
and remove the line which number is calculated in the example above as N=527111+422025.
This line would contain a float8 number like 1.2e-318.
After removing that line, you need to recreate and reload the database.
|