Apache Directory Project - [jira] Commented: (DIRMINA-119) Multiple selector loops

This is Interesting: Free IT Magazines  
Home > Archive > Apache Directory Project > December 2005 > [jira] Commented: (DIRMINA-119) Multiple selector loops





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author [jira] Commented: (DIRMINA-119) Multiple selector loops
dave irving (JIRA)

2005-12-01, 7:45 am

[ http://issues.apache.org/jira/brows...action_12359023 ]

dave irving commented on DIRMINA-119:
-------------------------------------

Yes, that is a good and logical solution. I did think a while back that keeping the threading at the io processor level might be a good way to go (see 4th post above). And infact, the refactoring which has been done for 0.9 such that SocketIoProcessor isn
't a singleton anymore makes it much easier.

Drawbacks.....

The only drawback I can see is that in many systems it is most efficient to have a single pool of selector loops driving the whole IO system (as the number of threads is tied to the number of CPUs). Going this route would mean we'd have a bunch of threads
for connectors and a bunch of threads for acceptors. Its not a huge problem though - just means we get slightly more context switching than we really need.

The other way round would be to change SocketSessionManager to just have a setter for a ProcessorFactory or something (as in 4th post above). That way we can use the same pool across the whole of mina (acceptors and connectors) - and we dont get any code
duplication as the factory does the round-robining instead of the acceptor / connector delegates.


> Multiple selector loops
> -----------------------
>
> Key: DIRMINA-119
> URL: http://issues.apache.org/jira/browse/DIRMINA-119
> Project: Directory MINA
> Type: Improvement
> Versions: 0.8
> Environment: All. Benefit is dependant on environment
> Reporter: dave irving
> Assignee: Trustin Lee
> Priority: Minor
> Fix For: 0.9
> Attachments: prototype.zip
>
> Mina's SocketIoProcessor currently owns a Selector and employs a single Worker to run the NIO "selector loop".
> I have been running tests where Im trying to maximise throughput and have found - that in certain multi-cpu environments - this worker thread can encounter a large amount of starvation even though CPU usage is fairly low.
> By testing 2 selector-loops instead of 1, I managed to improve my overall test throughput by just under 30%.
> The general idea is to do this:
> - Each SocketIoProcessor.Worker encapsulates its own work queues associated Selector
> - It should be possible to configure the number of Workers (and thus selectors) employed by SocketIoProcessor
> - When a SocketSession is added to the SocketIoProcessor, a Worker is selected (round-robin) which will be associated with the SocketSession for its lifetime. This association is managed by SocketSession (get/setWorker)
> - When someone asks SocketIoProcessor to do some work to a session, instead of doing it directly, the processor now asks the session for its Worker, and delegates to the worker (i.e, the same worker is always used for an individual session)
> I've done some prototyping, and have also checked that the concept works with the latest build.
> The prototype is very hacky - mainly because there are some refactoring issues i'd like feed-back on before I submit a "proper" patch for review. Namely:
> - How do you want me to tell the SocketIoProcessor how many workers to use? One option is a system property - but thats pretty hacky. I dont think we need to support changing the number of workers after operation has begun (It'll probably be a function

of the number of available CPUs) - and this makes the code simpler. However, as SocketIoProcessor is a (non lazy created) singleton, we need a way to get the param in. We could refactor, or maybe introduce a ProcessorOptions class or something. The Socket
IoProcessor could interrigate this when initializing. Any direction on your desired approach would be appreciated
> Cheers,
> Dave


--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secur...nistrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira


Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com