-1

I have a client sending around 500k requests (messages)/min. Each message will be around 200 bytes to 2KB. Each message will be saved in a database (like Couchbase).

What is the correct way to structure a Go TCP server in terms of cores, ports, connections and goroutines to handle this load?

Donovan
  • 816
  • 1
  • 10
  • 16
  • What have you tried? That's not a lot of requests, so create a proof of concept and test it. – JimB May 05 '16 at 14:17

1 Answers1

1

Like JimB mentions, a TCP server shouldn't be difficult to stand up and start benchmarking for your needs. A simple layout would be to wait on incoming TCP connections and then execute a go routine to handle it. In that goroutine you can put whatever blocking code you want, in this case a write out to a DB. Here is a link to a simple example:

Simple example

Once you get that working, you can make it more sophisticated if it doesn't meet your performance standards. Here is a nice example of using a worker pool to handle 1M HTTP requests per minute.

More sophisticated example

kbirk
  • 3,906
  • 7
  • 48
  • 72