4

I have written a simple client to test my Web Service, but I am investigating the possibility of using the JBoss Netty framework, rather than blocking sockets, in order to increase the number of concurrent connections I can make to the Web Service.

I understand that JBoss itself uses Netty, but I am using Tomcat (for the time being) and have no knowledge of it. Has anyone done this, or used something similar?

trojanfoe
  • 120,358
  • 21
  • 212
  • 242
  • Whether you use NIO or plain IO you can use up to 10K concurrent connections. IO will use more resources to do this but if you have plenty of memory or less than 1 K concurrent connections, you are unlikely to notice a significant difference. BTW I would be curious to know if you see a difference. – Peter Lawrey Feb 25 '11 at 16:32
  • But if each connection is blocking a thread, aren't I limited by the number of threads I can create? – trojanfoe Feb 25 '11 at 16:38
  • Yes, but question there is whether your concurrency will raise to that level? Modern OS/JVM combo can typically support up to low-thousands of threads, if most are inactive most of the time. – StaxMan Apr 25 '13 at 18:20

2 Answers2

6

Instead of trying to integrate someone else's Socket handling library into Tomcat, why not turn on Tomcat's NIO services? It may require upgrading to Tomcat 6.0, but depending on your experience with JBoss it might be a easier solution.

Edwin Buck
  • 69,361
  • 7
  • 100
  • 138
  • That's a useful answer, as I might well run into problems with scalability in the server, however I want to use Netty (or whatever) in the test client, not the server. – trojanfoe Feb 25 '11 at 15:57
  • This should have more up votes, very handy tip I didn't even realize was an option. Tomcat with direct byte buffers on NIO, very nice. Thanks Edwin. – Riyad Kalla Jul 20 '11 at 06:36
  • 1
    It's worth noting, however, that this only covers part of Servlet handling -- your actual request handling still needs a thread to bind to (for regular Servlet API at least). It can be useful, but depending on where most time is spent, not necessarily sufficient. – StaxMan Apr 25 '13 at 18:21
3

We have used both Netty and MINA in our implementations. Both wrap the underlying java NIO classes to make things a bit easier and concise. We went with Netty when comparing the two. We found that Netty was a bit easier and provided us more powerful uses for NIO. I'd suggest taking a look at this post as it has a pretty good comparison of the two.

Community
  • 1
  • 1
Scott
  • 16,711
  • 14
  • 75
  • 120
  • Can ask what implementation you are talking about? Did you have to write your Web Services API or did you modify an existing implemention? – trojanfoe Mar 05 '11 at 18:05
  • So we use JBossWS as our webservice provider (however we've moved almost everything to REST services now). We also use Netty separately for doing streaming. I'm pretty sure given the stack traces I've seen on JBoss WS, that they are leveraging Netty under the hood. So you may just want to leverage that library. – Scott Mar 06 '11 at 15:55