0

Scenario : n number of vehicles create tcp socket connections with the tcp server. Server then dumps incoming messages to a DB. Admins can send commands to the vehicles through the sockets as well so sockets have to be persistent.

Problem : Currently, there is only single tcp server and DB sever.

Question : How to make this architecture scalable in .NET. We want to have more tcp servers and DBs. Whats the best method/technology stack.

Thanks

asked Apr 21, 2015 at 7:31
3
  • .NET sockets scale reasonably well for most scenarios using any of the asynchronous APIs: Socket.Begin/EndXXX, Socket.XXXAsync (not task-based), NetworkStream.XXXAsync (task-based), etc.. The non-task-based XXXAsync approach has the best out-of-the-box scalability, but in every case scalability depends on a lot more than just the network API being used. As stated, your question is too broad. Try something, see how it works, and then if you have problems, ask a specific question about how to improve on what you have. Commented Apr 21, 2015 at 8:08
  • The maximum concurrent connections we have to handle is 1000. When I researched about this more, I realized that a single tcp server can comfortably handle that much of connections. However, assuming 1000 connections sending 10 messages per second, it is important DB connectivity is scalable. Given that each message calls a expensive stored procedure. Whats the best architecture, and would 1000 threads calling a stored procedure lead the server to failure. Commented Apr 21, 2015 at 23:37
  • one thread per connection is known not to scale. You need to use async and not tie up threads. Commented Apr 22, 2015 at 6:32

1 Answer 1

1

I believe what you are looking for is a messaging infrastructure, there are several well established libraries/products in this section( e.g. RabbitMQ, ZeroMQ, ...)

almost all of them supports patterns for distributing message across several producers/consumers, which makes writing scalable applications easier, ZeroMQ is something in the middle and the usage is very similar to sockets.

Aside from library selection I suggest you to have a look at ZMQ Guide, it describes patterns and best practices for writing an scalable application.

answered Apr 21, 2015 at 8:23

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.