Monday, November 14, 2011

ActiveMQ prefetch and Spring DMLC advice from Torsten

A piece of advice on ActiveMQ prefetch and Spring DMLC from my colleague Torsten.

I just remembered a lesson learned about prefetch and Spring DMLC:
If you configure DMLC to use CACHE_SESSION or below (i.e. CACHE_CONNECTION or CACHE_NONE) *and* when you don't use a CachingConnectionFactory (e.g SingleConnectionFactory), then you should set the prefetch for the Spring consumer to only 1 or 0.
That is because when not caching the consumer, a new JMS consumer is recreated for every msg that Spring will ask the broker for.
And if there are many msgs on the queue, the broker will prefetch e.g. 1000 msgs to the consumer although the consumer will only process one msg.
Spring DMLC then recycles the JMS consumer with 999 unprocessed msgs. This obviously causes to much and unnecessary load on the network.

So possible solutions in this case:
1) prefetch=0 or 1,
2) configure DMLC to use CACHE_CONSUMER, or
3) use Springs CachingConnectionFactory

Tuesday, November 8, 2011

Short Note on How to install Servicemix 4 as windows service.

To install Servicemix 4 as windows service need to start SMX from console and run features:install wrapper and wrapper:install and follow the instructions that are displayed by second karaf command.

Here is the output from a sample run :

karaf@root> features:install wrapper
karaf@root> wrapper:install
Creating file: C:\work\apache-servicemix-4.4.1-fuse-01-06\bin\karaf-wrapper.exe
Creating file: C:\work\apache-servicemix-4.4.1-fuse-01-06\etc\karaf-wrapper.conf

Creating file: C:\work\apache-servicemix-4.4.1-fuse-01-06\bin\karaf-service.bat
Creating file: C:\work\apache-servicemix-4.4.1-fuse-01-06\lib\wrapper.dll
Creating file: C:\work\apache-servicemix-4.4.1-fuse-01-06\lib\karaf-wrapper.jar
Creating file: C:\work\apache-servicemix-4.4.1-fuse-01-06\lib\karaf-wrapper-main

Setup complete. You may want to tweak the JVM properties in the wrapper configu
ration file:
before installing and starting the service.

To install the service, run:
C:> C:\work\apache-servicemix-4.4.1-fuse-01-06\bin\karaf-service.bat install

Once installed, to start the service run:
C:> net start "karaf"

Once running, to stop the service run:
C:> net stop "karaf"

Once stopped, to remove the installed the service run:
C:> C:\work\apache-servicemix-4.4.1-fuse-01-06\bin\karaf-service.bat remove

Hope this helps and serves as note to myself for future.