Repository navigation
multi threaded server - #83
Conversation
|
#79 |
…tructor Test implementation of an only partially blocking writing in the WebSocketServer.java
|
I was going to do this my self when I was writing a server for something with this API and then I dropped the project so I never started it. For performance wise. Just add in a check for if it's in use (Active) if not then sleep for a few then check again. Btw. I love this API saves my time although I wish the Client and Server were in different packages. |
|
How 95a615e works:
The queue will block until its there is space free which happens when the selector puts new websockets into it. Currently messages will be sent in a blocking way unless the messages are sent form inside a message handler. The websockets handleRead method must only be called once at the same time. During one select operation of the selector thread a websocket can only be put onto the queue once. But because a worker thread could still process a message of a previous selection i declared it synchronized. I also thought of using an an atomic boolean to abroad handleRead if there is still an handle read in progress but if that message would be the last message of a sequence of multiple ones there would be no way to detect that the channel of that websocket is ready to perform a read operation on. |
separated WebSocket interface and implementation introduced WebSocketFactory to allow users to better customize their websockets
Since the current head of this project is not working properly for more than a week now because i made a stupid mistake during merging stuff that should have belonged to this pull request i will now merge this pull request to be able focus on one branch instead of too. @sippykup Thanks for revealing those problems!
|
Since the current head of this project is not working properly for more than a week now because i made a stupid mistake during merging stuff that should have belonged to this pull request i will now merge this pull request to be able focus on one branch instead of too. @sippykup Thanks for revealing those problems! |
Since the current head of this project is not working properly for more than a week now because i made a stupid mistake during merging stuff that should have belonged to this pull request i will now merge this pull request to be able focus on one branch instead of too. @sippykup Thanks for revealing those problems!
The server did not scale very well because it uses only one thread at all. ( #79 )
Therefore i made the it multi threaded.
I validated the changes using the autobahn test suit and the stress test utility of the example folder.
The server at its current state uses blocking writing.
The old behavior was to block only if the internal message queue was full and notify the selector thread otherwise who then flushed all connections unwritten data...
I am not yet sure whats the best way to deal with writing so i would not merge yet.
Besides multi threaded code should be reviewed and checked as intense as possible :)