cfmlprojects / runwar

Other
11 stars 16 forks source link

Performance tuning options for undertow #71

Closed lmajano closed 7 years ago

lmajano commented 7 years ago

@denuno If you see the Undertow.Builder class there are several options for performance tuning. Is there a way to tap into them via CommandBox passthrough?

http://undertow.io/javadoc/1.3.x/io/undertow/Undertow.Builder.html

The ones I am interested are:

denuno commented 7 years ago

I've added options for setting these (not buffers per region tho, it doesn't do anything anymore), and for posterity, here is how the these things get set if you don't change them:

            ioThreads = Math.max(Runtime.getRuntime().availableProcessors(), 2);
            workerThreads = ioThreads * 8;
            long maxMemory = Runtime.getRuntime().maxMemory();
            //smaller than 64mb of ram we use 512b buffers
            if (maxMemory < 64 * 1024 * 1024) {
                //use 512b buffers
                directBuffers = false;
                bufferSize = 512;
            } else if (maxMemory < 128 * 1024 * 1024) {
                //use 1k buffers
                directBuffers = true;
                bufferSize = 1024;
            } else {
                //use 16k buffers for best performance
                //as 16k is generally the max amount of data that can be sent in a single write() call
                directBuffers = true;
                bufferSize = 1024 * 16;
            }

So we have --buffer-size int --direct-buffers true|false --io-threads int --worker-threads int command line options now.