Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-dev] What are Jetty 9s most performant APIs to use?

Danny,

there is no 10 thread minimum in the thread pool.

There are errors generated if there are insufficient thread for the acceptors/selectors, but you can configure your connector to have only 1 of each of these.

For example the following code starts a server fine:

        QueuedThreadPool qtp = new QueuedThreadPool(4, 1);
        Server server = new Server(qtp);
        ServerConnector connector = new ServerConnector(server, 1, 1);
        connector.setPort(8080);
        server.addConnector(connector);
        server.setHandler(new HelloHandler());

        server.start();
        server.dumpStdErr();
        server.join();


eg.

2014-07-09 13:24:10.420:INFO::main: Logging initialized @107ms
2014-07-09 13:24:10.488:INFO:oejs.Server:main: jetty-9.2.z-SNAPSHOT
2014-07-09 13:24:10.531:INFO:oejs.ServerConnector:main: Started ServerConnector@4ac93274{HTTP/1.1}{0.0.0.0:8080}
2014-07-09 13:24:10.532:INFO:oejs.Server:main: Started @244ms
org.eclipse.jetty.server.Server@2784de18 - STARTED
 += qtp155724457{STARTED,1<=3<=4,i=1,q=0} - STARTED
 |   +- 9 qtp155724457-9-selector-ServerConnectorManager@272c6f83/0 RUNNABLE @ sun.nio.ch.EPollArrayWrapper.epollWait(Native Method)
 |   +- 11 qtp155724457-11-acceptor-0-ServerConnector@4ac93274{HTTP/1.1}{0.0.0.0:8080} RUNNABLE @ sun.nio.ch.ServerSocketChannelImpl.accept0(Native Method)
 |   +- 12 qtp155724457-12 TIMED_WAITING @ sun.misc.Unsafe.park(Native Method) IDLE
 += ServerConnector@4ac93274{HTTP/1.1}{0.0.0.0:8080} - STARTED
 |   +~ org.eclipse.jetty.server.Server@2784de18 - STARTED
 |   +~ qtp155724457{STARTED,1<=3<=4,i=1,q=0} - STARTED
 |   += org.eclipse.jetty.util.thread.ScheduledExecutorScheduler@642daf7a - STARTED
 |   +- org.eclipse.jetty.io.ArrayByteBufferPool@1b523bd4
 |   += HttpConnectionFactory@33d5e94f{HTTP/1.1} - STARTED
 |   |   +- HttpConfiguration@20c85c1f{32768,8192/8192,https://:0,[]}
 |   += org.eclipse.jetty.server.ServerConnector$ServerConnectorManager@272c6f83 - STARTED
 |   |   +- org.eclipse.jetty.io.SelectorManager$ManagedSelector@751bd80c keys=0 selected=0 id=0
 |   |       +- org.eclipse.jetty.io.SelectorManager$ManagedSelector.select(SelectorManager.java:538)
 |   |       +- sun.nio.ch.EPollSelectorImpl@2da75e1b keys=0
 |   +- sun.nio.ch.ServerSocketChannelImpl[/0:0:0:0:0:0:0:0:8080]
 += org.eclipse.jetty.embedded.HelloHandler@1ac0bc3a - STARTED





On 1 July 2014 20:51, Danny <mail@xxxxxxxxxxxxxxxxx> wrote:
Greg,
Thanks for the reply.

I did indeed go for ServerConnector and combined it with Continuations to
achieve thread-less waiting. It works fine even with Thread Pools of the
minimum size (10) threads.

Is there any chance that in future versions of Jetty the minimum # threads
in the pool may be lower then 10 so that they can be set  equal to the
number of CPU cores. Lesser threads seem to work faster.

Also because for small foot-print embedded servers (e.g. Occasional low
frequency browser access to a Raspberry Pi  that is part of a home
automation system) 10 threads is overkill.

TIA



--
View this message in context: http://jetty.4.x6.nabble.com/What-are-Jetty-9s-most-performant-APIs-to-use-tp4962539p4962732.html
Sent from the Jetty Dev mailing list archive at Nabble.com.
_______________________________________________
jetty-dev mailing list
jetty-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-dev


Back to the top