You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by camel_el <er...@cse-cst.gc.ca> on 2010/09/20 19:05:03 UTC
UuidGenerator performance issue
Hi,
my system is generating a lot of exchanges (many concurrent threads), so
many that creating an exchange becomes a bottleneck. An exchangeId is
created by the UuidGenerator class, which is using
java.security.SecureRandom. SecureRandom then calls its secureRandomSpi:
UuidGenerator.generateUuid() -> UUID.randomUUID() ->
secureRandom.nextBytes(n) -> secureRandomSpi.engineNextBytes(n)
where secureRandomSpi.engineNextBytes(n) is synchronized. Obviously, this
call becomes a bottleneck. I have modified UuidGenerator so that it creates
a 1-up number (probably not the best, but it worked for the time being) and
I saw a major performance gain.
Would it be possible to:
1- Change the way Camel creates the exchangeId?
- or -
2- Provide a hook where we could supply our own ExchangeIdFactory?
If we use our own factory, what are the constraints?
Thanks.
--
View this message in context: http://camel.465427.n5.nabble.com/UuidGenerator-performance-issue-tp2846866p2846866.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: UuidGenerator performance issue
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
I created a ticket to switch to use the AMQ as the default uuid
generator as its much faster.
https://issues.apache.org/activemq/browse/CAMEL-3139
On Tue, Sep 21, 2010 at 8:05 AM, Claus Ibsen <cl...@gmail.com> wrote:
> Hi
>
> Can you try as suggested by Christian to use the ActiveMQ based UUID generator.
> And if possible can you post some details about the performance gain you see?
>
> We should consider switching the default uuid generator in Camel back
> to the AMQ based if its much faster.
> The JDK UUID based is used when you run Camel in the cloud which may
> not have access to some APIs which the AMQ based need on startup.
> So its a matter of just letting them use the Java UUID based if they
> run in the cloud, and we can use the fastes by default instead.
>
>
>
> On Mon, Sep 20, 2010 at 7:05 PM, camel_el <er...@cse-cst.gc.ca> wrote:
>>
>> Hi,
>>
>> my system is generating a lot of exchanges (many concurrent threads), so
>> many that creating an exchange becomes a bottleneck. An exchangeId is
>> created by the UuidGenerator class, which is using
>> java.security.SecureRandom. SecureRandom then calls its secureRandomSpi:
>>
>> UuidGenerator.generateUuid() -> UUID.randomUUID() ->
>> secureRandom.nextBytes(n) -> secureRandomSpi.engineNextBytes(n)
>>
>> where secureRandomSpi.engineNextBytes(n) is synchronized. Obviously, this
>> call becomes a bottleneck. I have modified UuidGenerator so that it creates
>> a 1-up number (probably not the best, but it worked for the time being) and
>> I saw a major performance gain.
>>
>> Would it be possible to:
>>
>> 1- Change the way Camel creates the exchangeId?
>> - or -
>> 2- Provide a hook where we could supply our own ExchangeIdFactory?
>> If we use our own factory, what are the constraints?
>>
>> Thanks.
>> --
>> View this message in context: http://camel.465427.n5.nabble.com/UuidGenerator-performance-issue-tp2846866p2846866.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Author of Camel in Action: http://www.manning.com/ibsen/
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
>
--
Claus Ibsen
Apache Camel Committer
Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Re: UuidGenerator performance issue
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
Can you try as suggested by Christian to use the ActiveMQ based UUID generator.
And if possible can you post some details about the performance gain you see?
We should consider switching the default uuid generator in Camel back
to the AMQ based if its much faster.
The JDK UUID based is used when you run Camel in the cloud which may
not have access to some APIs which the AMQ based need on startup.
So its a matter of just letting them use the Java UUID based if they
run in the cloud, and we can use the fastes by default instead.
On Mon, Sep 20, 2010 at 7:05 PM, camel_el <er...@cse-cst.gc.ca> wrote:
>
> Hi,
>
> my system is generating a lot of exchanges (many concurrent threads), so
> many that creating an exchange becomes a bottleneck. An exchangeId is
> created by the UuidGenerator class, which is using
> java.security.SecureRandom. SecureRandom then calls its secureRandomSpi:
>
> UuidGenerator.generateUuid() -> UUID.randomUUID() ->
> secureRandom.nextBytes(n) -> secureRandomSpi.engineNextBytes(n)
>
> where secureRandomSpi.engineNextBytes(n) is synchronized. Obviously, this
> call becomes a bottleneck. I have modified UuidGenerator so that it creates
> a 1-up number (probably not the best, but it worked for the time being) and
> I saw a major performance gain.
>
> Would it be possible to:
>
> 1- Change the way Camel creates the exchangeId?
> - or -
> 2- Provide a hook where we could supply our own ExchangeIdFactory?
> If we use our own factory, what are the constraints?
>
> Thanks.
> --
> View this message in context: http://camel.465427.n5.nabble.com/UuidGenerator-performance-issue-tp2846866p2846866.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
--
Claus Ibsen
Apache Camel Committer
Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Re: UuidGenerator performance issue
Posted by Christian Müller <ch...@gmail.com>.
Hello camel_el!
I think the page [1] contains all information you need. Starting with Camel
2.5, you can provide your own implementation of UuidGenerator.
[1] http://camel.apache.org/uuidgenerator.html
Regards,
Christian
On Mon, Sep 20, 2010 at 8:49 PM, Christian Müller <
christian.mueller@gmail.com> wrote:
> You can provider your down UUIDGenerator implementation. I will provide a
> more detailed answer when I'm at home.
>
> Christian
>
> Am 20.09.2010 19:05 schrieb "camel_el" <er...@cse-cst.gc.ca>:
>
>
>
> Hi,
>
> my system is generating a lot of exchanges (many concurrent threads), so
> many that creating an exchange becomes a bottleneck. An exchangeId is
> created by the UuidGenerator class, which is using
> java.security.SecureRandom. SecureRandom then calls its secureRandomSpi:
>
> UuidGenerator.generateUuid() -> UUID.randomUUID() ->
> secureRandom.nextBytes(n) -> secureRandomSpi.engineNextBytes(n)
>
> where secureRandomSpi.engineNextBytes(n) is synchronized. Obviously, this
> call becomes a bottleneck. I have modified UuidGenerator so that it
> creates
> a 1-up number (probably not the best, but it worked for the time being) and
> I saw a major performance gain.
>
> Would it be possible to:
>
> 1- Change the way Camel creates the exchangeId?
> - or -
> 2- Provide a hook where we could supply our own ExchangeIdFactory?
> If we use our own factory, what are the constraints?
>
> Thanks.
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/UuidGenerator-performance-issue-tp2846866p2846866.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
Re: UuidGenerator performance issue
Posted by Christian Müller <ch...@gmail.com>.
You can provider your down UUIDGenerator implementation. I will provide a
more detailed answer when I'm at home.
Christian
Am 20.09.2010 19:05 schrieb "camel_el" <er...@cse-cst.gc.ca>:
Hi,
my system is generating a lot of exchanges (many concurrent threads), so
many that creating an exchange becomes a bottleneck. An exchangeId is
created by the UuidGenerator class, which is using
java.security.SecureRandom. SecureRandom then calls its secureRandomSpi:
UuidGenerator.generateUuid() -> UUID.randomUUID() ->
secureRandom.nextBytes(n) -> secureRandomSpi.engineNextBytes(n)
where secureRandomSpi.engineNextBytes(n) is synchronized. Obviously, this
call becomes a bottleneck. I have modified UuidGenerator so that it creates
a 1-up number (probably not the best, but it worked for the time being) and
I saw a major performance gain.
Would it be possible to:
1- Change the way Camel creates the exchangeId?
- or -
2- Provide a hook where we could supply our own ExchangeIdFactory?
If we use our own factory, what are the constraints?
Thanks.
--
View this message in context:
http://camel.465427.n5.nabble.com/UuidGenerator-performance-issue-tp2846866p2846866.html
Sent from the Camel - Users mailing list archive at Nabble.com.