1

Problem: problem

We have a scenario in which:

  • we got a multiple modules (devices, audio, video) (max 10?)
  • multiple interface clients connecting to specified module (max 2/3?)

We are wondering how to properly manage the communication between interface clients and device clients. One solution is to make a server manager which will handle one connection to multiple interface clients and one connection to multiple modules. But, I'm not a fan of it due to multithreaded code that should be manage. Diagram: one server

So mine proposal is to make a manager which have got multiple servers, so each module and specified interface will be clients that communicate with concrete module server. Diagram:

multiple servers

Which one is better and why? In mine opinion the version with multiple servers will separate multithreaded logic for each module. On the other hand we will have multiple connections, but is it a thing to worry about it?

Thanks in advance.

  • Your question cannot be answered without doing (many) assumptions. More information is needed about the modules dependencies. Are their stateless? Can you draw a flow of a the requests? And I think that it is common to have only one question in one post. – elirandav Feb 25 '17 at 08:42
  • Hi. Thanks for the comment. I have edited the description. Regards! – lumyslinski Feb 25 '17 at 17:49
  • NP. If I understood right, you are basically asking if it is better to start writing microservices‑based application or monolith? – elirandav Feb 26 '17 at 07:26
  • Yes. Is it better to have multiple channel communications for each device or one channel for communication from devices to server and another one from server to each user interface. – lumyslinski Feb 26 '17 at 14:29

1 Answers1

1

There are many factors to consider if to start with few services or one. See here

But, I'm not a fan of it due to multithreaded code that should be manage

It sounds like your main concern is managing the thread per connection but the frameworks I encountered with (WCF in .NET and Spring MVC in JAVA) allow you to define a new thread per request by just Configuring it. You don't have to manage it by yourself.

Assuming that the code that "should be manage" is due to shared object then anyway you have to deal with this management when having few servers, but instead syncing threads you will sync servers.

Community
  • 1
  • 1
elirandav
  • 1,913
  • 19
  • 27
  • Thanks for the answer. The main concern is a routing communication in multithreaded code. We got multiple parallel user interfaces that invoke actions on multiple devices and receive statuses from them (or by server cache). – lumyslinski Feb 26 '17 at 17:45
  • Which framework are you using for the communication? WCF? Web API? – elirandav Feb 26 '17 at 18:02
  • After some research we are going to use signalr. Websockets are very fast. This is why I want use solution2 with multiple servers (hubs). – lumyslinski Feb 26 '17 at 19:28
  • Ok. I'm less familiar with that. I will delete the answer so you get more useful information :) – elirandav Feb 26 '17 at 22:40
  • You can mention the signalr in the question above also to get more relevant answers. – elirandav Feb 26 '17 at 22:52
  • Ok. Do not delete your post, it is very helpful :). We are not bound to one technology. Moreover, we can join wcf with signalr as a compromise. – lumyslinski Feb 27 '17 at 08:37