[
https://issues.apache.org/jira/browse/SSHD-1153?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17320717#comment-17320717
]
Lyor Goldstein commented on SSHD-1153:
--------------------------------------
{quote}What are the NIO2 worker threads, and how do they differ from*
*sshd-SftpSubsystem-thread-1, as we see most of the work is done by the latter
then what is the role of nio-worker thread
{quote}
NIO2 worker threads are responsible for handling raw incoming packets from NIO2
asynchronous sockets. Once a packet has been partially decoded and found to be
relevant to the SFTP subsystem (in this case), it is passed along to a
{{sshd-SftpSubsystem-thread-xx}} for further handling. This way, the NIO2
worker becomes available to handle the next incoming packet (which may be
relevant for some other channel - e.g., SCP) and thus not depend on the time it
takes to process the previous packet
{quote}Does increase the nio-worker thread count to 9,10 will increase the
throughput (we tried but we didn't found any negligible changes, what will be
the best optimum value recommended to be used?)
{quote}
Depends on the traffic actually - in view of my previous explanation.
Furthermore, at some time you may run into context switching overhead issues -
obviously, the more SFTP connections you have the more
{{sshd-SftpSubsystem-thread-xx}} threads are running and thus increase memory,
CPU, I/O and context switch overhead. Therefore it is hard to suggest an
"optimum" - as it depends on the kind of traffic - just good old trial and error
{quote} # *What are the*
IoServiceFactoryFactory ==> *NIO2, MINA, NETTY* How does this works
internally, and how performance will be affected with the different
*IoServiceFactoryFactory*.{quote}
The SSH code interacts with and +abstraction+ of the network layer - a.k.a an
{{IoServiceFactory}} - this factory is created by a {{IoServiceFactoryFactory}}
(perhaps not the best name for it). Currently we have 3 such +built-in+
implementations:
* NIO2 (the default and recommended one) - uses NIO2 asynchronous sockets
* MINA - uses Apache MINA network library
* NETTY - uses NETTY network library
You can actually provide your own (e.g., SSH over Bluetooth or your own
implementation over sockets) - I really recommend re-reading the documentation
- in this case [Selecting an
IoServiceFactoryFactory|https://github.com/apache/mina-sshd/blob/master/docs/internals.md#selecting-an-ioservicefactoryfactory]
- though I recommend reading (perhaps several times) the entire documentation
> NIO2 IOServiceFactory, NIO Worker Threads and the performance
> -------------------------------------------------------------
>
> Key: SSHD-1153
> URL: https://issues.apache.org/jira/browse/SSHD-1153
> Project: MINA SSHD
> Issue Type: Question
> Reporter: Susmit Sarkar
> Assignee: Jonathan Valliere
> Priority: Minor
> Attachments: image-2021-03-29-23-52-39-814.png,
> image-2021-03-29-23-54-01-301.png, image-2021-03-29-23-55-16-337.png,
> image-2021-03-29-23-55-33-299.png
>
>
> IoServiceFactoryFactory ==> *NIO2, MINA, NETTY*
> How does this works internally, and how performance will be affected with the
> different IoServiceFactoryFactory.
> We did lots of performance testing and found NIO2 is the best performing of
> the 3? Why is it the best of the other 2, and why Apache selects it as
> default. (Tested with 50-75 concurrent threads. Did 2 types of test *[1.] PUT
> for 1.5kb files for 75 concurrent threads [2.] PUT for 100 MB files for 40-50
> concurrent threads*)
> How do NIO Worker Threads affect the performance? Attaching a screenshot from
> the thread dump which I took
> !image-2021-03-29-23-52-39-814.png!
> All the threads in park state and some are runnable in different phases of
> execution. I am not able to decipher what does the stacks mean:
> The details which I got are (*PARKED*):
> !image-2021-03-29-23-54-01-301.png!
> For *RUNNABLE:*
> *!image-2021-03-29-23-55-33-299.png!*
> *Lastly, I want to bring this to notice not all threads are used out of 75
> threads I see 50 to be in runnable and the remaining 25 to be in the parked
> state, is it the expected behavior?*
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]