Hi all,

I'm looking for some good practices of concurrent programming in Go. 

My software works and even customer satisfied :). But I feel job doesn't done 
perfectly.

The task was to convert some well documented but proprietary protocol to 
Diameter with custom dictionary. 

But my feelings are not about protocols but about concurrent model which I 
implemented.

I spawn  goroutline per connection and this goroutline is responsible to 
assembly protocol messages from tcp stream. 

Then I spawn another goroutline to process protocol message (calculate Crc and 
etc and make request to Diameter server, receive answer from Diameter server, 
and send response to server).

This per-message goroutline gets two arguments. There are request  and channel.

As soon as per-request goroutline creates response it sends it to channel. 

Channel is processed by per-connection goroutine to send response.

I feel this simple model is not correct and stable under load. For example 
diameter server can be slow and number of goroutines and channels will grow 
dramatically. 

When I did similar job in erlang I used this process model. But there 
supervisor controlled per-request workers.

Originally C-version uses several native threads with async logic (select and 
epoll) inside them.

Probably same async model can be implemented in Go by I would like to have 
benefits of Go using its concurrency features.

Could you advise correct concurrent model for my task?

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to