Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > JMS vs Sockets -- bandwidth, size, speed, etc.

Reply
Thread Tools

JMS vs Sockets -- bandwidth, size, speed, etc.

 
 
me 2
Guest
Posts: n/a
 
      01-07-2013
On Wednesday, December 26, 2012 4:26:17 PM UTC-5, me2 wrote:
> Greetings,
>
>
>
> I am a newbie to JMS and would appreciate some advice.
>
>
>
> Has anyone compared JMS to socket programming? If I have N number of clients that need to connect to and send messages to 1 server, what is the comparison? I would guess that sockets--direct from a client to the server--would be the fastest for speed and maybe take the least bandwidth. But I would expect that there would only be negligible size increases for the JMS overhead once the connection was established and I would expect that a pub-sub topic would be able to smoke through sending the N number of clients messages, rather than loop through the connections/sockets and sending the message to each of them.
>
>
>
> Has anyone else looked at this? I'm going through the exercise to set upa JMS server, but I thought maybe someone else could point me in the rightdirection.
>
>
>
> Cheers,
>
> me2


I figured that if anyone else had this problem, then it would be worth passing on this information.

http://activemq.2283324.n4.nabble.co...td3718866.html

According to this, an empty message with no other information is about 300 and some odd bytes. So, the plain socket in our extremely low bandwidth project might be better served with plain sockets. Not the answer that I wanted, but still, at least, an answer.

Cheers all and thank you to everyone who responded.
me 2
 
Reply With Quote
 
 
 
 
Arne Vajhøj
Guest
Posts: n/a
 
      01-08-2013
On 1/7/2013 4:01 PM, me 2 wrote:
> I figured that if anyone else had this problem, then it would be
> worth passing on this information.
>
> http://activemq.2283324.n4.nabble.co...td3718866.html
>
> According to this, an empty message with no other information is
> about 300 and some odd bytes. So, the plain socket in our extremely
> low bandwidth project might be better served with plain sockets. Not
> the answer that I wanted, but still, at least, an answer.


That may be the case. Or it may not be the case.

If you want to know then measure.

If you expectation is that:

number of messages per time unit = constant * theoretical bandwidth /
message size

then you will be wrong for most networks.

I wrote a little test program (Java socket) to measure
the time it takes to send 1 million messages for
different message sizes.

Result:

size 100 : 4633 ms
size 200 : 4681 ms
size 300 : 4697 ms
size 400 : 4712 ms
size 500 : 4728 ms
size 600 : 4743 ms
size 700 : 4791 ms
size 800 : 4805 ms
size 900 : 4822 ms
size 1000 : 4852 ms
size 1100 : 4853 ms
size 1200 : 4899 ms
size 1300 : 4931 ms
size 1400 : 4915 ms
size 1500 : 6834 ms
size 1600 : 6912 ms
size 1700 : 6865 ms
size 1800 : 7005 ms
size 1900 : 6974 ms
size 2000 : 7130 ms
size 2100 : 7255 ms
size 2200 : 7318 ms
size 2300 : 7317 ms
size 2400 : 7302 ms
size 2500 : 7380 ms
size 2600 : 7395 ms
size 2700 : 7567 ms
size 2800 : 7583 ms
size 2900 : 7442 ms
size 3000 : 8082 ms
size 3100 : 8222 ms
size 3200 : 8191 ms
size 3300 : 8332 ms
size 3400 : 8222 ms
size 3500 : 9330 ms
size 3600 : 9407 ms
size 3700 : 9533 ms
size 3800 : 9377 ms
size 3900 : 9423 ms
size 4000 : 9439 ms
size 4100 : 9439 ms
size 4200 : 9517 ms
size 4300 : 9533 ms
size 4400 : 10359 ms
size 4500 : 10484 ms
size 4600 : 10407 ms
size 4700 : 10499 ms
size 4800 : 10578 ms
size 4900 : 10484 ms
size 5000 : 10500 ms

You will see that it does not grow linear instead it jumps
at multiples of X (where X is somewhere between 1400 and 1500
bytes).

Your absolute number may be very different.

And your X may be different.

But you should not be surprised if you see the same
effect.

And it does impact your conclusion.

If payload+300 < X then the 300 has practically
no impact on performance.

If payload < X < payload+300 then the 300 will have
a huge impact on performance.

And so on.

So you need to analyze and test more - otherwise you
could just as well have flipped a coin.

Arne

PS: If somebody want a copy of the code, then I will be happy
to post it, but it is rather trivial and somewhat unpolished.



 
Reply With Quote
 
 
 
 
Gene Wirchenko
Guest
Posts: n/a
 
      01-08-2013
On Mon, 07 Jan 2013 20:02:37 -0500, Arne Vajhøj <>
wrote:

[snip]

>I wrote a little test program (Java socket) to measure
>the time it takes to send 1 million messages for
>different message sizes.
>
>Result:


[snip]

>You will see that it does not grow linear instead it jumps
>at multiples of X (where X is somewhere between 1400 and 1500
>bytes).


An Ethernet frame contains up to 1500 bytes of payload. I
suspect that this is the explanation for the results you got.

[snip]

Sincerely,

Gene Wirchenko
 
Reply With Quote
 
Arne Vajhøj
Guest
Posts: n/a
 
      01-08-2013
On 1/7/2013 9:42 PM, Gene Wirchenko wrote:
> On Mon, 07 Jan 2013 20:02:37 -0500, Arne Vajhøj <>
> wrote:
>
> [snip]
>
>> I wrote a little test program (Java socket) to measure
>> the time it takes to send 1 million messages for
>> different message sizes.
>>
>> Result:

>
> [snip]
>
>> You will see that it does not grow linear instead it jumps
>> at multiples of X (where X is somewhere between 1400 and 1500
>> bytes).

>
> An Ethernet frame contains up to 1500 bytes of payload. I
> suspect that this is the explanation for the results you got.
>
> [snip]


Yes.

Arne


 
Reply With Quote
 
Robert Klemme
Guest
Posts: n/a
 
      01-08-2013
On Monday, January 7, 2013 10:01:12 PM UTC+1, me 2 wrote:

> I figured that if anyone else had this problem, then it would be worth passing on this information.
>
> http://activemq.2283324.n4.nabble.co...td3718866.html
>
> According to this, an empty message with no other information is about 300 and some odd bytes. So, the plain socket in our extremely low bandwidth project might be better served with plain sockets. Not the answer that I wanted, but still, at least, an answer.


As far as I can see that's just _one_ product. That does not necessarily mean that all others have the same overhead, does it?

Kind regards

robert
 
Reply With Quote
 
Mark
Guest
Posts: n/a
 
      01-08-2013
On Thu, 27 Dec 2012 13:26:31 -0500, Arne Vajhøj <>
wrote:

>On 12/26/2012 11:46 PM, wrote:
>> I believe socket has the best performance, i tried to user socket and pipeline to send data to a c++ program, socket win.

>
>Hmmm.
>
>How did you test JMS from C++?
>
>


e.g. ActiveMQ-CPP
--
(\__/) M.
(='.'=) If a man stands in a forest and no woman is around
(")_(") is he still wrong?

 
Reply With Quote
 
Arne Vajhøj
Guest
Posts: n/a
 
      01-09-2013
On 1/8/2013 4:28 AM, Mark wrote:
> On Thu, 27 Dec 2012 13:26:31 -0500, Arne Vajhøj <>
> wrote:
>> On 12/26/2012 11:46 PM, wrote:
>>> I believe socket has the best performance, i tried to user socket and pipeline to send data to a c++ program, socket win.

>>
>> Hmmm.
>>
>> How did you test JMS from C++?
>>
>>

>
> e.g. ActiveMQ-CPP


Most message queues has a C/C++ client lib.

But JMS ...

Arne


 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      01-11-2013
What is JMS using under the covers? UDP, TCP/IP?

--
Roedy Green Canadian Mind Products http://mindprod.com
Students who hire or con others to do their homework are as foolish
as couch potatoes who hire others to go to the gym for them.
 
Reply With Quote
 
Lew
Guest
Posts: n/a
 
      01-11-2013
Roedy Green wrote:
> What is JMS using under the covers? UDP, TCP/IP?


Shared memory.

As Arne pointed out near the start of this discussion:
> JMS is just an API.


Systems I've worked on have done different things depending on the
configuration. Shared memory, dedicated pipes, specialized sockets
are three things that can come in the very same JMS system.

GIYF.

--
Lew

 
Reply With Quote
 
Arne Vajhøj
Guest
Posts: n/a
 
      01-12-2013
On 1/11/2013 4:07 AM, Roedy Green wrote:
> What is JMS using under the covers? UDP, TCP/IP?


I will tell you right after you tell me what transport classes
implementing this interface:

public interface ThisIsJustAnAPI {
public void doSomething();
}

use!



Or maybe you realize something ....

Arne




 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
implementing or using jms or running jms without application server ravinder.ggl@gmail.com Java 0 06-26-2007 10:26 AM
How to setup JBoss for JMS (not MDB-JMS) ? Thomas Stein Java 0 10-18-2004 09:10 PM
JMS and servlets iksrazal Java 0 07-30-2003 09:27 PM
JMS Question Dane Java 1 07-30-2003 03:38 PM
video capture using JMS Zamf Java 0 07-05-2003 08:33 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57