Hi, I just wanted your opinion on an api that I’m designing for work.
What we’re working on is a networking lib that we can use internally that we know inside out. I know there are exisiting librarys out there however company wants to have their own library.
The goal is to have an api that is scalable and multithreaded. Multithreading seems to be a heavy topic for us atm and we don’t want to keep things single threaded (although there will be support for this)
Some snippets from a report that somebody did:
Networky is a Java networking library based of NIO.2. It is a solution to creating multithreaded networks. Everything is handled asynchronously, we try to reduce waiting time for operations to complete as much as possible. Networky does its best to remove the need for queuing (or at least lessen it) by running tasks in parallel.
A traditional system would only have one thread to listen connections. This is fine however introduces a long queuing system. Imagine waiting in line to buy tickets for the cinema to watch a new movie that has come out. The line is long and there is only 1 person serving at the checkouts. What Networky is trying to achieve is to reduce the wait time for clients so that they can quickly be processed and handled.Now the Handlers, if you think of all the people in the cinema watching a movie, they all (logically, not scientifically) receive data at the same time. As Networky is still in very early development, feel free to contribute your thoughts to this. Creating a new Handler for every Channel seems very resourceful. The HandlerWorker in the above image purpose is to show a ConnectionHandler. This ConnectionHandler would deal with channelOpen, channelClose, channelRead, channelWrite and so forth. Small applications may find it hard to deal with a massive number of Handlers. Just like the Listeners, the Handlers will try to process as many people as it can at once and reduce the queue time by as much as possible.
Yes it’s garbage.
They want to have multiple worker threads that handle listening and handling.
The Moparscape community (while still under mitb :p) are pro vets and I’m sure you guys can give me all your opinions on this.
What do you think about the concept? Any possible design ideas? Help me!