PERFORMANCE TUNING
Here you can see a few options you can set to tune the performance
of your webserver.
Threads Tuning:
In the myserver.xml file you can setup the amount of threads MyServer
will use. In the lines below, you configure the two configurable
parameters NTHREADS_STATIC
and NTHREADS_MAX, the first one is used to
define number of threads always alive, the second one is used to
define the highest number of threads that myserver can create:
<NTHREADS_STATIC>10</NTHREADS_STATIC>
<NTHREADS_MAX>10</NTHREADS_MAX>
Buffer Size:
You can set the size of the Buffers used by MyServer, by setting the line below, in the myserver.xml file:
<BUFFER_SIZE>102400</BUFFER_SIZE>
Just change the default value 102400 to your desired number. Remember
that, in fact, your buffer will be twice the value you set here (in
Bytes), multiplied by the number of running threads.
Connection Timeout:
In myserver.xml, you can set the timeout for
client connections to your server, in the line below:
<CONNECTION_TIMEOUT>60</CONNECTION_TIMEOUT>
The time unit is seconds. So, in the line above, if your client
doesn't access your site for more than 60 seconds, the connection will
be closed. Or if you prefer, set this value to 0 and you won't have
HTTP Keep-Alive Connections.
Max Connections:
You can change the default maximum number of connections your webserver will
accept, by changing the line below
in myserver.xml:
<MAX_CONNECTIONS>0</MAX_CONNECTIONS>
The default value 0 means you will accept infinite connections. Any other value
will limit how many users will be accessing your server.
Max Servers processes:
MyServer lets you configure the maximum number of external servers (for example
these external servers can be FastCGI applications) allowed to run, changing
the value in the line below, in myserver.xml:
<MAX_SERVERS_PROCESSES>10</MAX_SERVERS_PROCESSES>
Setting CGI Timeout:
You can set the default timeout for your CGI scripts in MyServer by
changing the value of the variable CGI_TIMEOUT in
your myserver.xml file.
Just change the line below to fit your need:
<CGI_TIMEOUT>15</CGI_TIMEOUT>
The configuration above would mean you are setting the CGI Timeout to 15 seconds (unit is "seconds")
Setting data throttling:
You can set the data throttling rate for connections in MyServer (by
default, it's disabled) by adding a line like the following:
<THROTTLING_RATE>1024</THROTTLING_RATE>
(Unit is bytes/second)
If that same line is available
in virtualhosts.xml, it will enable and
configure data throttling for the corresponding virtual host.
Also, you can configure the data throttling for individual
directories, using these configurations in your security file:
<USER NAME="Guest" PASS="" READ="TRUE" WRITE="TRUE" BROWSE="TRUE"
EXECUTE="TRUE" THROTTLING_RATE="1024"/>
With that, you'd enabling the trottling of 1024 bytes/second for the user Guest.
If you add a line like the following, you will be enabling throttling for a file named "bigfile":
<ITEM FILE="bigfile" READ="TRUE" WRITE="FALSE" EXECUTE="FALSE"
THROTTLING_RATE="1024" />
You can also mix the two possibilities and set this configuration for
a specified user on a single file:
<ITEM FILE="bigfile" READ="TRUE" WRITE="FALSE" EXECUTE="FALSE">
<USER NAME="Guest" PASS="" READ="TRUE" WRITE="TRUE" BROWSE="TRUE"
EXECUTE="TRUE" THROTTLING_RATE="1024"/>
</ITEM>
This is the order of checking for data throttling configuration:
- User & file(USER attribute inside ITEM).
- File(ITEM attribute).
- User(USER attribute).
- Virtual host(virtualhosts.xml file).
- Server configuration(myserver.xml file).
Static files cache:
It is possible to configure a cache for static files, in this way it is not
needed to open a new file for each request but read directly from a buffer in
the memory. The cache is configured trough three values in myserver.xml.
MAX_FILESCACHE_SIZE defines the max dimension in
bytes for the cache. A value of zero means the caching mechanism is not
used.
MAX_FILESCACHE_FILESIZE defines the max dimension in
bytes for a file to be added in the cache. It is a good idea to put a limit
here and don't cache big files, the overhead caused by opening big files and
send them is unnoticeable, in addition it would be better to use the buffer for
many small files than few big ones. A value of zero means that this limit is
not used.
MIN_FILESCACHE_FILESIZE defines the min dimension in
bytes for a file to be added in the cache. It is better to use a low value for
it. A value of zero means that this limit is not used.
<MAX_FILESCACHE_SIZE>100000000000</MAX_FILESCACHE_FILESIZE>
<MAX_FILESCACHE_FILESIZE>100000</MAX_FILESCACHE_FILESIZE>
<MIN_FILESCACHE_FILESIZE>0</MIN_FILESCACHE_FILESIZE>