Does pax-jms degrade the overall performance?

21 views
Skip to first unread message

Kushal Gautam

unread,
Jun 17, 2019, 4:57:32 AM6/17/19
to OPS4J
Hi:

I am using Camel with Karaf, and ActiveMQ

Before using pax-jms, I was providing connectionfactories as artifact. But, since it was not configurable, I planned to switch it to pax-jms.

But, so far, after switching to pax-jms, I have noticed performance lag in message processing. I am not entirely sure, if this is due to pax-jms. 

Thus, in general, does pax-jms degrade the message processing performance at all?

For example, my jms-config looks like:

name = eai-producer
jms.url = tcp://localhost:61616
jms.username = system
jms.password = manager
type = activemq
pool = pooledjms
osgi.jndi.service.name = jms/producer
org.apache.karaf.features.configKey = org.ops4j.connectionfactory-producer

Regards,
Cooshal.

Jean-Baptiste Onofré

unread,
Jun 17, 2019, 5:02:33 AM6/17/19
to op...@googlegroups.com

Hi

PAX Jms should not degrade the performance. It depends how do you compare, especially the connection factory and the pooling.

How did you configure the connection factory in your bundle ?

Regards
JB

--
--
------------------
OPS4J - http://www.ops4j.org - op...@googlegroups.com

---
You received this message because you are subscribed to the Google Groups "OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ops4j+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ops4j/dc425a85-23d9-4f47-a855-9d9d96a70689%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Grzegorz Grzybek

unread,
Jun 17, 2019, 5:02:40 AM6/17/19
to op...@googlegroups.com
Hello

What kind of processing performance problems do you have? pax-jms doesn't add any special processing - it only deals with exposing connection factories to your beans/components/services/...

PooledJMS itself MAY add some processing overhead, but it of course depends on its configuration. After your application calls javax.jms.ConnectionFactory.getConnection(), it's all up to you/camel-jms/spring-jms how to use/cache/not-cache it...

I'm interested in some numbers, logs maybe - how did you find out that the performance is worse?

thanks in advance for any help/feedback
regards
Grzegorz Grzybek

--

Kushal Gautam

unread,
Jun 17, 2019, 6:08:14 AM6/17/19
to OPS4J
Hi:

my connection factory configuration looked like:

<?xml version="1.0" encoding="UTF-8"?>
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="
            ">
    
    <cm:property-placeholder persistent-id="prs-eai-broker" update-strategy="reload" >
        <cm:default-properties>
            <cm:property name="URL" value="tcp://localhost:61616" />
            <cm:property name="USERNAME" value="system" />
            <cm:property name="PASSWORD" value="manager" />
            <cm:property name="MAX_CONNECTIONS" value="20" />
            <cm:property name="PRODUCER_JNDI_NAME" value="jms/producer" />
            <cm:property name="CONSUMER_JNDI_NAME" value="jms/consumer" />
        </cm:default-properties>
    </cm:property-placeholder>  

    <bean id="activemqConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
        <property name="brokerURL" value="${URL}" />
        <property name="userName" value="${USERNAME}" />
        <property name="password" value="${PASSWORD}" />
    </bean>

    <bean id="consumerPooledConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory">
        <property name="maxConnections" value="${MAX_CONNECTIONS}" />
        <property name="connectionFactory" ref="activemqConnectionFactory" />
    </bean>
    
    <bean id="producerPooledConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory">
        <property name="maxConnections" value="${MAX_CONNECTIONS}" />
        <property name="connectionFactory" ref="activemqConnectionFactory" />
    </bean>

    <service ref="producerPooledConnectionFactory" interface="javax.jms.ConnectionFactory">
        <service-properties>
            <entry key="name" value="producer" />
            <entry key="osgi.jndi.service.name" value="${PRODUCER_JNDI_NAME}" />
        </service-properties>
    </service>
    
    <service ref="consumerPooledConnectionFactory" interface="javax.jms.ConnectionFactory">
        <service-properties>
            <entry key="name" value="consumer" />
            <entry key="osgi.jndi.service.name" value="${CONSUMER_JNDI_NAME}" />
        </service-properties>
    </service>

</blueprint>
To unsubscribe from this group and stop receiving emails from it, send an email to op...@googlegroups.com.

Kushal Gautam

unread,
Jun 17, 2019, 6:11:20 AM6/17/19
to OPS4J
Currently, I am observing some lag in putting the messages in one of the queues. Roughly, the number is about 1-4 messages per second. And, this is way too slow than my previous configuration.

I checked this from the activemq console.

I will try to see if I can produce some performance metrics. But, the thing is that I observed the enqueue/dequeue rates to be extremely slow.

Regards,
Cooshal.
To unsubscribe from this group and stop receiving emails from it, send an email to op...@googlegroups.com.

Grzegorz Grzybek

unread,
Jun 17, 2019, 6:20:52 AM6/17/19
to op...@googlegroups.com
Hello

What was your previous configuration? Is there a chance to get a stack trace from under the debugger in the place where message is put into queue?

regards
Grzegorz Grzybek

To unsubscribe from this group and stop receiving emails from it, send an email to ops4j+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ops4j/3c8d060e-8f7b-4c47-aee3-1b955d217aef%40googlegroups.com.

Kushal Gautam

unread,
Jun 17, 2019, 7:05:22 AM6/17/19
to OPS4J
Hi:

this was my previous config:

I will try to see if I can get the stack trace. This problem is currently there in the prod. system. So, I have to check that once.

Regards,
Cooshal.

Grzegorz Grzybek

unread,
Jun 17, 2019, 8:10:28 AM6/17/19
to op...@googlegroups.com
Hello

Hmm

You wrote two similar blueprint files containing:

    <bean id="activemqConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
        <property name="brokerURL" value="${URL}" />
        <property name="userName" value="${USERNAME}" />
        <property name="password" value="${PASSWORD}" />
    </bean>

Having etc/org.ops4j.connectionfactory-producer.cfg doesn't affect your ActiveMQCOnnectionFactory + org.apache.activemq.pool.PooledConnectionFactory beans...

With pax-jms, you should expose underlying connection javax.jms.ConnectionFactory OSGi service (ActiveMQConnectionFactory) without org.apache.activemq.pool.PooledConnectionFactory.

Probably with pax-jms you have 3 layers: pooled-jms → PooledConnectionFactory → ActiveMQConnectionFactory.

Now you don't need org.apache.activemq.pool.PooledConnectionFactory beans.

regards
Grzegorz Grzybek


To unsubscribe from this group and stop receiving emails from it, send an email to ops4j+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ops4j/13c998f7-3dc2-4a5e-b894-8622ce1dbad4%40googlegroups.com.

Kushal Gautam

unread,
Jun 17, 2019, 2:32:31 PM6/17/19
to OPS4J
Hi again:

yes. because of several issues, I switched to pax-jms from the blueprint configuration. I found it much easier exposing connectionFactories via etc/*.cfg files.

I am still observing the metrics right now. I have restarted the broker service, and karaf instances as well. 

Regards,
Cooshal.

Kushal Gautam

unread,
Jun 18, 2019, 9:31:13 AM6/18/19
to OPS4J
Hi again:

I have a query on this issue.

From the connections tab in the activemq webconsle, I see that my hundreds of connections are reduced to very few connections. That helped me resolve some jms-error issues, where my packets were being dropped because my broker was overloaded.

When I look at the details of the connection, I see multiple consumer sessions. 

I am not able to comprehend the working method of this. Are all these sessions using just one connection??

Regards,
Cooshal.

Jean-Baptiste Onofré

unread,
Jun 18, 2019, 9:45:41 AM6/18/19
to op...@googlegroups.com

Hi,

That's the way JMS works.

You create a ConnectionFactory. The connection factory provides connections.

A connection provides several sessions. A session is single threaded, and "assigned" to an action (consume or produce).

So, inside a single connection (for one client), you can have bunch of sessions (some producing, some consuming). In Camel, you can define the number of sessions per connection.

For consuming, you can use the receive() method or a MessageListener. The session is also where you define the ACK mode (AUTO, CLIENT, DUPS, TRANSACTED).

If you need more details, don't hesitate to ping me directly ;)

Regards
JB

To unsubscribe from this group and stop receiving emails from it, send an email to ops4j+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ops4j/0f4804ab-4425-4a3d-a830-4d021f07422f%40googlegroups.com.

Kushal Gautam

unread,
Jun 18, 2019, 9:52:57 AM6/18/19
to OPS4J
Hi:

ok. that's what I thought.

So, here is my scenario. I have 4 karaf instances, and each instance has two pax-jms configurations(one for producer and one for consumer). But, in the connections tab, I see just one connection per instance. Is this a normal behavior? Because, I have two pax-jms configs and shldn't they have two connections per instance, in this case? I have to verify this thing with my previous implementation (while deploying broker as an artifact).

Regards,
Cooshal.

Jean-Baptiste Onofré

unread,
Jun 18, 2019, 9:59:28 AM6/18/19
to op...@googlegroups.com

If you have two ConnectionFactory services, maybe you use only one service, that would explain why you only have one connection (with one producer and one consumer).

Regards
JB

To unsubscribe from this group and stop receiving emails from it, send an email to ops4j+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ops4j/f44f861b-9793-4155-af05-57a60182c5a4%40googlegroups.com.

Kushal Gautam

unread,
Jun 18, 2019, 10:02:35 AM6/18/19
to OPS4J
well, I am using them as:

<reference id="jmsConsumerConnectionFactory" interface="javax.jms.ConnectionFactory" filter="(osgi.jndi.service.name=jms/eai.consumer)" availability="mandatory" />
    <reference id="jmsProducerConnectionFactory" interface="javax.jms.ConnectionFactory" filter="(osgi.jndi.service.name=jms/eai.producer)" availability="mandatory" />
    
    <bean id="eai-consumer" class="org.apache.camel.component.jms.JmsComponent">
        <property name="connectionFactory" ref="jmsConsumerConnectionFactory"/>
    </bean>
    
    <bean id="eai-producer" class="org.apache.camel.component.jms.JmsComponent">
        <property name="connectionFactory" ref="jmsProducerConnectionFactory"/>
    </bean>

Jean-Baptiste Onofré

unread,
Jun 18, 2019, 10:06:20 AM6/18/19
to op...@googlegroups.com

Why don't you set the connection factory directly on the camel-jms URI ?

For instance: <from uri="jms:queue:foo?connectionFactory=#jmsConsumerConnectionFactory"/>

Regards
JB

To unsubscribe from this group and stop receiving emails from it, send an email to ops4j+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ops4j/67d50e80-2975-4db6-b999-7a93066d0aaf%40googlegroups.com.

Kushal Gautam

unread,
Jun 18, 2019, 10:09:24 AM6/18/19
to OPS4J
I am using it like this:

from("eai-consumer:queue:foo.xx.yy") 
...
...

Is there a performance lag for this as well ?

Kushal Gautam

unread,
Jun 18, 2019, 10:49:05 AM6/18/19
to OPS4J
Hi:

Here's what I have observed.

If I provide the broker service by installing the broker bundle as an artifact (using the blueprint configuration as I had shared before), then there are altogether 41 connections(one is of Temp Advisory queue, I guess), because max-connections is set to 20 for producer and consumer each.

But, with pax-jms config, I observed that I have just 20 connections (although I have set pool.maxConnections = 20) for both producer and consumer. I guess, this could be the bottleneck of the performance.

In both scenarios, the route bundles are same. Only the broker service provider is diff.

Regards,
Cooshal.

Grzegorz Grzybek

unread,
Jun 19, 2019, 2:01:19 AM6/19/19
to op...@googlegroups.com
Hello

But as you wrote, you had this blueprint:

    <bean id="activemqConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
        <property name="brokerURL" value="${URL}" />
        <property name="userName" value="${USERNAME}" />
        <property name="password" value="${PASSWORD}" />
    </bean>

    <bean id="consumerPooledConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory">
        <property name="maxConnections" value="${MAX_CONNECTIONS}" />
        <property name="connectionFactory" ref="activemqConnectionFactory" />
    </bean>
...
    <service ref="producerPooledConnectionFactory" interface="javax.jms.ConnectionFactory">
        <service-properties>
            <entry key="name" value="producer" />
            <entry key="osgi.jndi.service.name" value="${PRODUCER_JNDI_NAME}" />
        </service-properties>
    </service>
...

which means it's not related to pax-jms. But additionally you added pax-jms configuration (factory PID) that does one thing - checks OSGi services with javax.jms.ConnectionFactory interfaces (which is your org.apache.activemq.pool.PooledConnectionFactory) and wraps it again in the pooling connection factory.

Can you share your entire project (before and after adding pax-jms)?

regards
Grzegorz Grzybek

To unsubscribe from this group and stop receiving emails from it, send an email to ops4j+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ops4j/5cf80056-ba28-4ede-acb8-e704e1460ebe%40googlegroups.com.

Kushal Gautam

unread,
Jun 19, 2019, 3:13:36 AM6/19/19
to OPS4J
Hi:

Sorry for the confusion, and mix-ups.

Those were totally different approaches that I had tried. I will explain what I did.

1. Initially, before trying out pax-jms, I was providing the broker connectionfactory using blueprint, as I had mentioned earlier. This approach was working fine enough, and then we decided to switch to pax-jms.
2. In the second scenario, the broker connectionfactory is entirely provided by pax-jms. Blueprint is not used in this case.

I have two connectionfactories, and I am using them as:

<reference id="jmsConsumerConnectionFactory" interface="javax.jms.ConnectionFactory" filter="(osgi.jndi.service.name=jms/eai.consumer)" availability="mandatory" />
<reference id="jmsProducerConnectionFactory" interface="javax.jms.ConnectionFactory" filter="(osgi.jndi.service.name=jms/eai.producer)" availability="mandatory" />

<bean id="eai-consumer" class="org.apache.camel.component.jms.JmsComponent">
    <property name="connectionFactory" ref="jmsConsumerConnectionFactory"/>
</bean>

<bean id="eai-producer" class="org.apache.camel.component.jms.JmsComponent">
    <property name="connectionFactory" ref="jmsProducerConnectionFactory"/>
</bean>

In both cases, I have set maxConnections to 20. Thus, with two connectionFactories, I observed that, with pax-jms only 20 connections were there. While, with the blueprint approach, I could see 20(consumer) + 20(producer) connections.

and I am using this in my camel routes as:

from("eai-consumer:queue:foo.xx.yy")  ...

I will share a project where this problem can be replicated.

My pax-jms based approach is in this (https://github.com/cooshal/karaf-assembly-jms) project. I will update this project later (on a different branch) with the blueprint based approach as well. It does not have camel routes yet, I will add some camel routes to demonstrate this issue.

Regards,
Cooshal.

Grzegorz Grzybek

unread,
Jun 21, 2019, 9:33:26 AM6/21/19
to op...@googlegroups.com
Hello

my list of unread (unanswered) emails is too long ;) Please let me know when you add this branch with blueprint, so I can compare these two approaches. Then I'll continue the investigation of your case.

regards
Grzegorz Grzybek

To unsubscribe from this group and stop receiving emails from it, send an email to ops4j+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ops4j/c2367cf3-3cf6-4eca-ac4d-da340eed8273%40googlegroups.com.

Kushal Gautam

unread,
Jun 26, 2019, 2:07:08 AM6/26/19
to OPS4J
Hi:

sorry, took a bit longer than expected. Currently, I have switched to blueprint based connectionfactory provider. The performance is much better this way, as.

I have implemented two scenarios, one with pax-jms based provider and the other is blueprint based provider.


I created two different bundles with camel routes (one to produce a message and the other to consume a message). The broker bundle (in both cases) will provide two diff connection factories, i.e. eai-producer and eai-consumer. I have used them in the camel routes respectively.

While using pax-jms, I see just a single connection from the ActiveMQ web console. In my example, I have given just one route. While, in my real case scenario, I had multiple routes, and all of them were under the same connection.

My assumption was, there should have been at least two different connections, as I had two different connection factories.

I have added a docker-compose file for activemq broker.

Kindly, please let me know if I need to explain the case further.

Regards,
Cooshal.

Grzegorz Grzybek

unread,
Jun 26, 2019, 3:27:25 AM6/26/19
to op...@googlegroups.com
Hello Kushal


on Monday I'm starting my deserved, 2 week holidays so I won't do much investigation now.

If you believe the performance is worse with pax-jms, please try getting for example 1000 thread dumps every 100ms - if there are lot of threads waiting to acquire the connection, there may be pooling configuration problem. Generally a thread dump (set of dumps) can give you some clues.

regards
Grzegorz Grzybek

To unsubscribe from this group and stop receiving emails from it, send an email to ops4j+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ops4j/a021ebc8-3de4-4e89-b7e2-beb318d8a961%40googlegroups.com.

Kushal Gautam

unread,
Jun 26, 2019, 3:43:31 AM6/26/19
to OPS4J
Hi:

Yes, that doesn't have a pool config right now. I was testing with and without pool configs in pax-jms, but then I might have pushed the one without pool config.

I had to switch to blueprint based provider as I was able to process just 2-3 messages per second(with pax-jms) compared to 200-300 messages per second (with blueprint-based connectionfactory provider).

I will investigate this and try to get a better picture of this problem, following your suggestion.

I will post back on this thread if I manage to get the results.

Thank you.

and wish you a nice holiday :)

Regards,
Cooshal.

Jean-Baptiste Onofré

unread,
Jun 26, 2019, 4:14:51 AM6/26/19
to op...@googlegroups.com

I will take a look on your code.

I keep you posted later today.

Regards
JB

To unsubscribe from this group and stop receiving emails from it, send an email to ops4j+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ops4j/b608ac0c-1125-42fc-9f09-602a65a1d0e3%40googlegroups.com.

Kushal Gautam

unread,
Jun 26, 2019, 5:04:30 AM6/26/19
to OPS4J
Hi:

thank you.

Regards,
Cooshal.

Grzegorz Grzybek

unread,
Jun 26, 2019, 5:06:29 AM6/26/19
to op...@googlegroups.com
śr., 26 cze 2019 o 09:43 Kushal Gautam <kushal...@gmail.com> napisał(a):
Hi:

Yes, that doesn't have a pool config right now. I was testing with and without pool configs in pax-jms, but then I might have pushed the one without pool config.

I had to switch to blueprint based provider as I was able to process just 2-3 messages per second(with pax-jms) compared to 200-300 messages per second (with blueprint-based connectionfactory provider).

I will investigate this and try to get a better picture of this problem, following your suggestion.

I will post back on this thread if I manage to get the results.

Sure - I'll be checking.


Thank you.

and wish you a nice holiday :)

thanks! :)

regards
Grzegorz Grzybek

To unsubscribe from this group and stop receiving emails from it, send an email to ops4j+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ops4j/b608ac0c-1125-42fc-9f09-602a65a1d0e3%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages