Re: [xSocket-develop] Performance issue
Status: Inactive
Brought to you by:
grro
|
From: Betten, T. <tho...@op...> - 2009-02-25 14:40:28
|
Hello, thanks for quick reply. Does it mean that NIO approach is actually (always) slower, but more robust regarding tons of socket connections? In my tests the common approach was about twice as fast. Are there any programming pitfalls that I am in since performance is so bad? Maybe a bad code section outsmarts the NIO benefit. I cannot believe that xSocket-based implementation is so slow since it states being appropriate for building high performce and high scalable servers. Maybe inefficient usage of NonBlockingConnection, wrong flush-mode or inappropriate write-transfer-rate... *sigh* Gregor Roth <gre...@gm...> hat am 25. Februar 2009 um 11:57 geschrieben: > > Hi Thorben, > > > in general the non-blocking I/O-approach addresses scalability. If you have only to support a few connections currently, you will reach a better response time by using blocking IO. By running blocking IO a dedicated thread listens for incoming data. The non-blocking approach is based on the NIO Selector (Java 1.7 will introduce true async IO) which adds indirection by reading and writing. > > > By flushing data, the xSocket-internal out buffer will be written into the OS socket buffer. If you are using the sync flush mode, the flush method will block until the data is written into the OS socket buffer. By using the async flush mode xSocket will write the out data into the OS socket buffer in async mode. This means the flush method returns immediately. In contrast to the sync flush mode no internal thread synchronization is required. For this reason setting the flush mode to async can improve the performance. Unfortunately some restrictions exist for the async flushmode. See http://xsocket.sourceforge.net/core/apidocs/2_4_3/org/xsocket/connection/INonBlockingConnection.html#setFlushmode(org.xsocket.connection.IConnection.FlushMode) > > > Regards > Gregor > > > > > > > ----- Original Message ----- > > From: "Betten, Thorben" > > Sent: 24/02/09 05:35 pm > > To: xso...@li... > > Subject: [xSocket-develop] Performance issue > > > > > > Dear mailing list, > > > > I've written an AJP server using xSocket v2.4.3 library since I read many articles > > stating that NIO is a must-have to build a high-performance and scalable web application. > > > > > > So I started to implement an alternative to my common thread-per-socket approach, but > > the test results (using JMeter) showed that the xSocket implementation is slower than > > the old approach. > > > > Is this a "normal" behavior? Meaning "Of course your application is slower, but more > > scalable and robust regarding many, many socket connections" > > > > I guess I'm using wrong or even missing necessary tuning parameters, but the performace > > section in the online documentation does not give me a hint. Currently server runs in > > SYNC mode. > > > > Here's a list of options/properties I use: > > - On server creation: > > sysprops.put("org.xsocket.connection.server.readbuffer.usedirect", "true"); > > - onConnect(): > > connection.setAutoflush(false); > > connection.setOption(INonBlockingConnection.TCP_NODELAY, "true"); > > > > > > Is the ASYNC flush-mode generally preferable to SYNC mode? > > What is an appropriate value for write transfer rate if package size is limited to 8192 bytes? > > Are there any other tuning options that I am missing? > > > > Any help would be appreciated... > > > > > > -- > > Thorben Betten > > > > > > > > > > > > -- Thorben Betten Engineering - Back-End-Team Open-Xchange AG Phone: +49 2761 8385-16, Fax: +49 2761 838530 ------------------------------------------------------------------------------- Open-Xchange AG, Maxfeldstr. 9, 90409 Nürnberg, Amtsgericht Nürnberg HRB 24738 Vorstand: Rafael Laguna de la Vera, Aufsichtsratsvorsitzender: Richard Seibt European Office: Open-Xchange GmbH, Martinstr. 41, D-57462 Olpe, Germany Amtsgericht Siegen, HRB 8718, Geschäftsführer: Frank Hoberg, Martin Kauss US Office: Open-Xchange, Inc., 303 South Broadway, Tarrytown, New York 10591 ------------------------------------------------------------------------------- |