I am writing a network application using java.nio api. My plan is to do I / O on one thread and handle events on another. To do this, I need to synchronize the read / write so that the race condition is never fulfilled.
Given that I need to process thousands of connections at the same time, is synchronization worth it, or should I use a single thread to handle I / O and events?
What kind of event handling are you doing? Where is the likely bottleneck? Do you even have a bottleneck?
Start with the simplest implementation and optimize bottlenecks as soon as you know them.
, IO , , , .
, , . - , , .
.
, , , .
, , .
Source: https://habr.com/ru/post/1741313/More articles:What is the point of using a “real” database modeling tool? - databaseС# - доступ к элементам коллекции, унаследованной от List - collectionsJava: String compare library that returns diff value as int? - javaShould the web service allow the user to create and update, or just save? - architectureКонтроль нескольких gen_servers с тем же модулем/разными аргументами - erlangUnique user ID in a Pylons web application - pythonarrange keywords by frequency in PHP mySql - sqlHow can I split email address into different parts of php? - javascriptAccess to SQL query Circular reference error - sqlJunit test that creates other tests - javaAll Articles