Le 15/08/14 08:32, Quah Kean Jin a écrit :
> what do you do on the server side with the data you
> receive ?
> Jin > I will parse the XML and store in to database but for my current
> testing I have taken out all those. Now just left this line in
> messageReceived() method: logger.info( "###>>> Received Data: " + xmlData );
>
> Initially my thought is the XML parsing and database operations causing the
> problem but after taken out the problem remains there.
>
> My further finding is when there is only one session/user opens (continue
> sending request every 200 ms) the performance is very good but when there
> is 75 sessions/users connecting to NioSocketAcceptor the performance is
> dropping - from log file the NioSocketAcceptor looks like need to take some
> rest/breath before perform further processing.

Then you might have some contention issue. Are you sure your parser is
concurrent ?
>
> Is there anyway to allocate more resources to IoSession pool via API?

Sure. You have two possible options :
- define more IoProcessor (just set the number of processor you want to
create in the IoAcceptor constructor :
http://mina.apache.org/mina-project/apidocs/org/apache/mina/transport/socket/nio/NioSocketAcceptor.html#NioSocketAcceptor%28int%29

- add an executor in your filter chain (that will increase the number of
threads you can use).

But I do think that both those options are workaround for your pb which
most certainly lies in your XML parser.

Parsing XML is extremelly costly : unless you use a smart XML parser ( a
pull parser which allows to resume if even a tag is split in the middle,
like Aalto parser https://github.com/FasterXML/aalto-xml), it will boild
down to reparse the full XML input. If you receive small chunks of data
at a time (say 100 bytes at a time) out of a 100k XML file, that means
you will parse your XML file 1000 times before you get your message
generated. Very CPU intensive, and quite inneficient.

Reply via email to