BobHoliday

Member
Sep 6, 2013
23
3
53
cPanel Access Level
Root Administrator
I have a perl script that runs in an account on my WHM cPanel server that's quite heavy on resources.

I've recently got myself a new VPS with more ram, more processors, better network connectivity etc.

Initially the script wouldn't work because of a lack of DBD/mysql.pm which I installed after finding this command in the forums somewhere, which worked for me:

/scripts/perlinstaller --force Bundle::DBD::mysql

It subsequently ran without an issue, but was considerably slower than it was on the much lower spec, older VPS. Ten seconds on the new server, five seconds on the old.

The script does a lot of database access and a lot of writing files to the filesystem (it's a script that pushes out a static website with circa 2000 pages, based on database content).

Everything else on this new server WHM, cPanel, websites etc etc is noticeably faster than it was on the old one.

How can I improve the speed of this perl script? Why might it be slow? I'm running PHP-FPM - related?

Thank you!
 

GOT

Get Proactive!
PartnerNOC
Apr 8, 2003
1,757
311
363
Chesapeake, VA
cPanel Access Level
DataCenter Provider
If your script has no php reliances (which is unlikely) then running php as fpm would not matter.

You may want to look at your my.cnf on the old server vs. the new. You may have had a better config installed. The default cpanel config does not have a lot of optimization in place.

its also possible that the IO is more constrained on the new VM. Run top while you are running your script. What does load go to and what does the IO or wa % indicate during the process?
 

BobHoliday

Member
Sep 6, 2013
23
3
53
cPanel Access Level
Root Administrator
Thank you for the reply. I saw peaks of ~62% CPU and 0.2% Mem for the process. WA got to 4.0 briefly ( I don't have a clue what 'WA' is).

I have tweaked the my.cnf somewhat based on suggestions from mysqltuner.pl. it's currently (and was when I saw the above results):

[mysqld]
default-storage-engine=MyISAM
innodb_file_per_table=1
innodb_log_file_size=16M
innodb_buffer_pool_instances=1
performance-schema=0
max_allowed_packet=268435456
open_files_limit=10000
local-infile=0
max_connections = 200
join_buffer_size=8M
tmp_table_size=128M
max_heap_table_size=128M
performance_schema = ON
query_cache_size=0
query_cache_type=0
query_cache_limit=8M
key_buffer_size=32M

On my old server it's different you're quite right - is this related to the speediness:
[mysqld]
performance-schema=0
max_allowed_packet=268435456
key_buffer_size=512M
thread_concurrency=4
open_files_limit=10000
innodb_file_per_table=1
read_rnd_buffer_size=16M
socket="/var/lib/mysql/mysql.sock"
read_buffer_size=1M
max_connections=80
port=3306
myisam_sort_buffer_size=64M
skip-external-locking
query_cache_type=1
query_cache_size=256M
query_cache_limit=2M
tmp_table_size=32M
max_heap_table_size=32M
bind-address=127.0.0.1
join_buffer_size=4M
local-infile=0
innodb_buffer_pool_size=128M
sort_buffer_size=1M
table_open_cache=4096
thread_cache_size=8
server-id=1
default-storage-engine=MyISAM

[myisamchk]
sort_buffer_size=64M
read_buffer=2M
key_buffer_size=64M
write_buffer=2M

[mysql]
no-auto-rehash
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,296
1,269
313
Houston