4 ms·
if there is mutex involved it will always be blocking in some way. the best way i think would be to package the client's request with response channel. loop thr
by 02020202 6y ago
if there is mutex involved it will always be blocking in some way. the best way i think would be to package the client's request with response channel. loop through incoming requests and pass them to workers(goroutines) which will send the response to individual client and close said response channel. then it is merely a decision on whether to go with N workers that will process the request channel or if each request will result in its own worker via goroutine.