Skip to content

Advanced Configuration

Ryan Slominski edited this page Feb 15, 2024 · 8 revisions

Tomcat Message Size Limit

There can be a limit to the size of a single websocket message. In Tomcat the default maximum message size is 8192 bytes. If you hit this limit you may get an error in the browser console that reads:

The decoded text message was too big for the output buffer and the endpoint does not support partial messages

You can configure Tomcat to have a bigger maximum (consider the server memory requirements though). Edit the web.xml file and add the following:

<context-param>
    <param-name>org.apache.tomcat.websocket.textBufferSize</param-name>
    <param-value>16384</param-value>
</context-param>
<context-param>
    <param-name>org.apache.tomcat.websocket.binaryBufferSize</param-name>
    <param-value>16384</param-value>
</context-param>  

Another option is to send monitor / clear requests to the server in batches of no more than a moderate number of PV names. This is done automatically by default in epics2web and controlled via the chunkedRequestPvsCount option. By default no more than 400 PV names will be transmitted at a time - the software will automatically issue multiple requests if necessary. With this option disabled the message limit can be reached for example by calling the jlab.epics2web.monitorPvs(pvs) method with 1000 PV names of 9 characters each.

Apache Process Limit

If you are proxying via Apache HTTPD and Apache is configured to run in pre-fork mode you need to ensure you have the process limit set high enough. The symptom if you hit the limit is requests hang and then timeout and you can query the number of processes with ps. If in pre-fork mode and no limit is explicitly set the default is 255 I believe. In our case we delegated to an IT department to host the external proxy and later determined they (a) were using pre-fork and (b) had set an explicit limit of 75. We fixed it with:

Set limit explicitly:

    ServerLimit      255
    MaxClients       255

Find out how many processes you have running:

[root@epicsweb /]# ps -ef | grep httpd | wc -l
77
Clone this wiki locally