I'm currently trying to process a bunch of data with apache and php,
I estimate it will take a few hours and I'd like to reduce that time
In my webmin I see following information
CPU usage 25% user, 0% kernel, 19% IO, 55% idle
is there a way i can dedicate more cpu usage to the process temporarily? (even if it means changing configs and restarting apache twice)
it's basically a lot of mysql selects/inserts/updates and regex
The processor is Intel(R) Core(TM)2 Quad CPU Q9400 @ 2.66GHz, 4 cores
Thanks for any tips on how to improve the speed
edit The CPU usage list shows this
ID Owner CPU Command
26841 mysql 38.6 % /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file ...
5627 www-data 0.3 % /usr/sbin/apache2 -k start
Given that you've got a quad core CPU and you're using exactly a quarter of it, I'd be inclined to say that you're running all your data processing in one single-threaded job. This will only use one CPU core. Rewrite your code to execute several tasks in parallel (either through threads or multiple independent processes) and it will use all of your CPU cores correctly. This is not a trivial operation.
Note that questions regarding parallelising your code should be directed to Stack Overflow.
MySQL from version 5.0 is already multi-threaded and optimized for running on multi-core systems. Is your disk subsystem running well ? Maybe the disk is representing the bottleneck.
Otherwise, you have to recode your PHP scripts in order to run as multiple parallel processes as stated above. PHP does not fully support threading within one instance, or it is struggle to use it.
@edit: Or you can divide data to some blocks if it is possible and process it by running multiple different PHP scripts.