In HCL Commerce, the Commerce Remote Store (CRS), otherwise known as the
Store server, implements the Hystrix framework as a proxy for backend
resources such as the Transaction server and Search server by
default. This can be disabled, but does have performance implications that must be
considered.
About this task
The Hystrix
framework executes back-end requests on a separate thread pool to help control and
limit the number of concurrent threads that are allowed. The framework also provides other
features such as circuit breakers, timeouts, fall backs, and metrics, but these capabilities
are not used with the CRS.
Impacts on HCL Commerce include increased troubleshooting complexity and higher
memory requirements. Another consideration that must be made is the fact that Hystrix is no
longer maintained to a high degree. These factors must be weighed against its limited use by
the CRS. Taking these factors into consideration, it is recommended that this feature be
disabled.
Procedure
-
Disable Hystrix on the Store server.
-
Open the Store server configuration file (wc-store.xml) for editing.
This file is located within the crs.ear/xml/config/
directory.
-
Set the enableHystrix parameter to
false.
The following can be added to your Dockerfile to implement this change on image
deployment.
RUN sed -i 's/enableHystrix=\"true\"/enableHystrix=\"false\"/g' /opt/WebSphere/Liberty/usr/servers/default/apps/crs.ear/xml/config/wc-store.xml
-
Reconfiguring the Default Executor thread pool.
The WebSphere Application Server Liberty server that the CRS runs on implements a single
thread pool named "Default Executor" to handle incoming requests. This pool is
self-tuned and adapts to the current workload by dynamically adding or removing
threads.
The implication of disabling the Hystrix request pools is that in case of a slow down
in the back-end servers WebSphere Application Server Liberty might allow the Default Executor
pool to expand, which could result in a large number of threads executing and waiting
for a response from the back-end services. To avoid this condition, it is possible to
configure the Default Executor pool with an upper limit by adding a custom configuration
file.
To set a limit for the Default Executor pool, customize the CRS image by adding a new
WebSphere Application Server Liberty configuration file.
-
Create a file named threadpool.xml.
Within it, add the following
configuration:
<server>
<executor name="Default Executor" id="default" coreThreads="50" maxThreads="50" />
</server>
-
Add the threadpool.xml configuration file to the CRS image by
adding this instruction to Dockerfile.
COPY threadpool.xml /opt/WebSphere/Liberty/usr/servers/default/configDropins/overrides/threadpool.xml
Results
Hystrix is no longer used to proxy requests to the back-end
services. The Default Executor pool is constrained to avoid the possibility of unbounded
threads waiting and causing performance implications.