Reputation: 32331
I took a Virtual private server from GoDaddy and installed GlassFish 4 on it. I am doing Performance Tuning on the server.
I have came across the following line:
Some settings are easier to change using the GlassFish administration console rather than poking around in the configuration files themselves. One example is acceptor threads, which should be set to a number equal the number of CPU cores in your server. So, if you have 2 CPUs with 4 cores each, the value should be 8.
Could you please tell me how can I can find out how many CPUs I have, and what value should I set?
Upvotes: 2
Views: 240
Reputation: 20738
If you do not need to find this programmatically, you can do:
grep processor /proc/cpuinfo | wc -l
That will give you the number of cores, including things like hyper threading, available to the kernel. To exclude such virtual cores:
grep 'core id' /proc/cpuinfo | sort | uniq | wc -l
In programs, you will find that the standard libraries, if they have threading support at all, provide means to get the number of hardware threads (cores). In C++, you would use std::thread::hardware_concurrency()
, in python there is multiprocessing.cpu_count()
.
However, depending on the "virtualisation" in place at your provider, the number of cores availlable to the kernel might higher than the number of cores available to your virtual private system. You have to check your contract to see how many cores they guarantee you. If they do not make any statement on that, you have to benchmark, although that probably depends on the time of day (and the load produced by others with whom you share the same hardware).
Upvotes: 1