You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by tho huynh ngoc <ng...@gmail.com> on 2015/04/08 14:44:35 UTC

Buffer size of UDP - JAX-WS server

Hi,

 I have developed a JAX-WS server with UDP transport. Supposing i have N
client.

At the same time, the N client send n packet (the size of packet is M
bytes).

My question: the maximum value of N is how many without packet loss?

Thanks in advance for your response

Best regards

Re: Buffer size of UDP - JAX-WS server

Posted by Daniel Kulp <dk...@apache.org>.
You’re not setting a bus there so you’d end up using the default Bus.   Just call:

Bus bus = Bus.getDefaultBus();

and then all the WQM stuff I had below.  Do that once prior to your code below.

Dan



> On Apr 10, 2015, at 4:17 PM, tho huynh ngoc <ng...@gmail.com> wrote:
> 
> I'm using the CXF service in OSGi. Server implementation is declared like
>        JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
>        factory.setAddress("udp://192.168.56.1:9292/print");
>        factory.setServiceClass(Service.class);
>        factory.setServiceBean(this);
>        factory.getInInterceptors().add(new LoggingInInterceptor());
>        factory.getOutInterceptors().add(new LoggingOutInterceptor());
>        factory.create().start();
> 
> I configured UDP like http://cxf.apache.org/docs/udp-transport.html
> 
> Tho,
> 
> 2015-04-10 22:03 GMT+02:00 Daniel Kulp <dk...@apache.org>:
> 
>> 
>>> On Apr 10, 2015, at 3:45 PM, tho huynh ngoc <ng...@gmail.com>
>> wrote:
>>> 
>>> Hi Daniel,
>>> 
>>> Please let me know how to tune the CXF' work queue ? what is the size of
>>> queue in CXF (UDP transport) ?
>> 
>> Are you using code or spring config or OSGi or what?
>> 
>> In code, you should be able to do something like:
>> 
>> WorkQueueManager wqm = bus.getExtension(WorkQueueManager.class);
>> AutomaticWorkQueueImpl wq = new AutomaticWorkQueueImpl("udp-transport");
>> wq.setHighWaterMark(50); ///50 threads
>> //any other settings here
>> wqm.addNamedWorkQueue("udp-transport", wq);
>> 
>> Do that before you startup any services.  That will create a new work
>> queue SPECIFICALLY for the udp transport to use.   The udp transport looks
>> for a queue named "udp-transport" and uses it if found.   If not, it will
>> use the default work queue.    Thus, you could grab the DefaultWorkQueue
>> from the WorkQueueManager and just call the setHighWatermark on it if you
>> want.  However, the default work queue is used for other use cases in CXF
>> as well (one ways, some WS-RM and ws-addrressing things, async http,
>> etc....)  Thus, having the dedicated work queue might be best.
>> 
>> 
>> The default is 25 threads and a queue depth of 256 outstanding things
>> waiting to run on those threads.  Lots of settings on the work queues:
>> 
>> http://cxf.apache.org/javadoc/latest-3.0.x/index.html?org/apache/cxf/workqueue/AutomaticWorkQueueImpl.html
>> (although not documented very well, or at all)
>> 
>> Dan
>> 
>> 
>> 
>> 
>> 
>> 
>>> 
>>> Regards,
>>> Tho,
>>> 
>>> 2015-04-10 19:54 GMT+02:00 Daniel Kulp <dk...@apache.org>:
>>> 
>>>> 
>>>>> On Apr 8, 2015, at 8:44 AM, tho huynh ngoc <ng...@gmail.com>
>>>> wrote:
>>>>> 
>>>>> Hi,
>>>>> 
>>>>> I have developed a JAX-WS server with UDP transport. Supposing i have N
>>>>> client.
>>>>> 
>>>>> At the same time, the N client send n packet (the size of packet is M
>>>>> bytes).
>>>>> 
>>>>> My question: the maximum value of N is how many without packet loss?
>>>>> 
>>>>> Thanks in advance for your response
>>>> 
>>>> Would likely completely depend on the network, the speed of the machine,
>>>> etc...  I doubt you can get an solid number for "N".
>>>> 
>>>> We use the mina NioDatagramAcceptor with an acceptor that just takes the
>>>> datagram and then sticks the "work" onto a work queue to process and
>> then
>>>> goes back to listening.  Thus, it should be fairly efficient.   The
>> default
>>>> work queue uses 25 threads, but that can be tuned using CXF's work queue
>>>> settings.
>>>> 
>>>> --
>>>> Daniel Kulp
>>>> dkulp@apache.org - http://dankulp.com/blog
>>>> Talend Community Coder - http://coders.talend.com
>>>> 
>>>> 
>> 
>> --
>> Daniel Kulp
>> dkulp@apache.org - http://dankulp.com/blog
>> Talend Community Coder - http://coders.talend.com
>> 
>> 

-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com


Re: Buffer size of UDP - JAX-WS server

Posted by tho huynh ngoc <ng...@gmail.com>.
I'm using the CXF service in OSGi. Server implementation is declared like
        JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
        factory.setAddress("udp://192.168.56.1:9292/print");
        factory.setServiceClass(Service.class);
        factory.setServiceBean(this);
        factory.getInInterceptors().add(new LoggingInInterceptor());
        factory.getOutInterceptors().add(new LoggingOutInterceptor());
        factory.create().start();

I configured UDP like http://cxf.apache.org/docs/udp-transport.html

Tho,

2015-04-10 22:03 GMT+02:00 Daniel Kulp <dk...@apache.org>:

>
> > On Apr 10, 2015, at 3:45 PM, tho huynh ngoc <ng...@gmail.com>
> wrote:
> >
> > Hi Daniel,
> >
> > Please let me know how to tune the CXF' work queue ? what is the size of
> > queue in CXF (UDP transport) ?
>
> Are you using code or spring config or OSGi or what?
>
> In code, you should be able to do something like:
>
> WorkQueueManager wqm = bus.getExtension(WorkQueueManager.class);
> AutomaticWorkQueueImpl wq = new AutomaticWorkQueueImpl("udp-transport");
> wq.setHighWaterMark(50); ///50 threads
> //any other settings here
> wqm.addNamedWorkQueue("udp-transport", wq);
>
> Do that before you startup any services.  That will create a new work
> queue SPECIFICALLY for the udp transport to use.   The udp transport looks
> for a queue named "udp-transport" and uses it if found.   If not, it will
> use the default work queue.    Thus, you could grab the DefaultWorkQueue
> from the WorkQueueManager and just call the setHighWatermark on it if you
> want.  However, the default work queue is used for other use cases in CXF
> as well (one ways, some WS-RM and ws-addrressing things, async http,
> etc....)  Thus, having the dedicated work queue might be best.
>
>
> The default is 25 threads and a queue depth of 256 outstanding things
> waiting to run on those threads.  Lots of settings on the work queues:
>
> http://cxf.apache.org/javadoc/latest-3.0.x/index.html?org/apache/cxf/workqueue/AutomaticWorkQueueImpl.html
> (although not documented very well, or at all)
>
> Dan
>
>
>
>
>
>
> >
> > Regards,
> > Tho,
> >
> > 2015-04-10 19:54 GMT+02:00 Daniel Kulp <dk...@apache.org>:
> >
> >>
> >>> On Apr 8, 2015, at 8:44 AM, tho huynh ngoc <ng...@gmail.com>
> >> wrote:
> >>>
> >>> Hi,
> >>>
> >>> I have developed a JAX-WS server with UDP transport. Supposing i have N
> >>> client.
> >>>
> >>> At the same time, the N client send n packet (the size of packet is M
> >>> bytes).
> >>>
> >>> My question: the maximum value of N is how many without packet loss?
> >>>
> >>> Thanks in advance for your response
> >>
> >> Would likely completely depend on the network, the speed of the machine,
> >> etc...  I doubt you can get an solid number for "N".
> >>
> >> We use the mina NioDatagramAcceptor with an acceptor that just takes the
> >> datagram and then sticks the "work" onto a work queue to process and
> then
> >> goes back to listening.  Thus, it should be fairly efficient.   The
> default
> >> work queue uses 25 threads, but that can be tuned using CXF's work queue
> >> settings.
> >>
> >> --
> >> Daniel Kulp
> >> dkulp@apache.org - http://dankulp.com/blog
> >> Talend Community Coder - http://coders.talend.com
> >>
> >>
>
> --
> Daniel Kulp
> dkulp@apache.org - http://dankulp.com/blog
> Talend Community Coder - http://coders.talend.com
>
>

Re: Buffer size of UDP - JAX-WS server

Posted by Daniel Kulp <dk...@apache.org>.
> On Apr 10, 2015, at 3:45 PM, tho huynh ngoc <ng...@gmail.com> wrote:
> 
> Hi Daniel,
> 
> Please let me know how to tune the CXF' work queue ? what is the size of
> queue in CXF (UDP transport) ?

Are you using code or spring config or OSGi or what?

In code, you should be able to do something like:

WorkQueueManager wqm = bus.getExtension(WorkQueueManager.class);
AutomaticWorkQueueImpl wq = new AutomaticWorkQueueImpl(“udp-transport”);
wq.setHighWaterMark(50); ///50 threads
//any other settings here
wqm.addNamedWorkQueue(“udp-transport”, wq);

Do that before you startup any services.  That will create a new work queue SPECIFICALLY for the udp transport to use.   The udp transport looks for a queue named “udp-transport” and uses it if found.   If not, it will use the default work queue.    Thus, you could grab the DefaultWorkQueue from the WorkQueueManager and just call the setHighWatermark on it if you want.  However, the default work queue is used for other use cases in CXF as well (one ways, some WS-RM and ws-addrressing things, async http, etc….)  Thus, having the dedicated work queue might be best.


The default is 25 threads and a queue depth of 256 outstanding things waiting to run on those threads.  Lots of settings on the work queues:
http://cxf.apache.org/javadoc/latest-3.0.x/index.html?org/apache/cxf/workqueue/AutomaticWorkQueueImpl.html
(although not documented very well, or at all)

Dan






> 
> Regards,
> Tho,
> 
> 2015-04-10 19:54 GMT+02:00 Daniel Kulp <dk...@apache.org>:
> 
>> 
>>> On Apr 8, 2015, at 8:44 AM, tho huynh ngoc <ng...@gmail.com>
>> wrote:
>>> 
>>> Hi,
>>> 
>>> I have developed a JAX-WS server with UDP transport. Supposing i have N
>>> client.
>>> 
>>> At the same time, the N client send n packet (the size of packet is M
>>> bytes).
>>> 
>>> My question: the maximum value of N is how many without packet loss?
>>> 
>>> Thanks in advance for your response
>> 
>> Would likely completely depend on the network, the speed of the machine,
>> etc...  I doubt you can get an solid number for "N".
>> 
>> We use the mina NioDatagramAcceptor with an acceptor that just takes the
>> datagram and then sticks the "work" onto a work queue to process and then
>> goes back to listening.  Thus, it should be fairly efficient.   The default
>> work queue uses 25 threads, but that can be tuned using CXF's work queue
>> settings.
>> 
>> --
>> Daniel Kulp
>> dkulp@apache.org - http://dankulp.com/blog
>> Talend Community Coder - http://coders.talend.com
>> 
>> 

-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com


Re: Buffer size of UDP - JAX-WS server

Posted by tho huynh ngoc <ng...@gmail.com>.
Hi Daniel,

Please let me know how to tune the CXF' work queue ? what is the size of
queue in CXF (UDP transport) ?

Regards,
Tho,

2015-04-10 19:54 GMT+02:00 Daniel Kulp <dk...@apache.org>:

>
> > On Apr 8, 2015, at 8:44 AM, tho huynh ngoc <ng...@gmail.com>
> wrote:
> >
> > Hi,
> >
> > I have developed a JAX-WS server with UDP transport. Supposing i have N
> > client.
> >
> > At the same time, the N client send n packet (the size of packet is M
> > bytes).
> >
> > My question: the maximum value of N is how many without packet loss?
> >
> > Thanks in advance for your response
>
> Would likely completely depend on the network, the speed of the machine,
> etc...  I doubt you can get an solid number for "N".
>
> We use the mina NioDatagramAcceptor with an acceptor that just takes the
> datagram and then sticks the "work" onto a work queue to process and then
> goes back to listening.  Thus, it should be fairly efficient.   The default
> work queue uses 25 threads, but that can be tuned using CXF's work queue
> settings.
>
> --
> Daniel Kulp
> dkulp@apache.org - http://dankulp.com/blog
> Talend Community Coder - http://coders.talend.com
>
>

Re: Buffer size of UDP - JAX-WS server

Posted by Daniel Kulp <dk...@apache.org>.
> On Apr 8, 2015, at 8:44 AM, tho huynh ngoc <ng...@gmail.com> wrote:
> 
> Hi,
> 
> I have developed a JAX-WS server with UDP transport. Supposing i have N
> client.
> 
> At the same time, the N client send n packet (the size of packet is M
> bytes).
> 
> My question: the maximum value of N is how many without packet loss?
> 
> Thanks in advance for your response

Would likely completely depend on the network, the speed of the machine, etc…  I doubt you can get an solid number for “N”.

We use the mina NioDatagramAcceptor with an acceptor that just takes the datagram and then sticks the “work” onto a work queue to process and then goes back to listening.  Thus, it should be fairly efficient.   The default work queue uses 25 threads, but that can be tuned using CXF’s work queue settings.  

-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com