Client Server Model for N-Tier Architecture - Mapping chained client>>server>>server>>client request / response

softwareengineering.stackexchange https://softwareengineering.stackexchange.com/questions/361143

  •  23-01-2021
  •  | 
  •  

سؤال

I am trying to search for a framework or library or even techniques for handling N-Tier Client/Server communications.

I am scaling my application software and I am seeing this communication becoming more and more cumbersome. I have an application server, but I also have middle servers for scaling the capacity of connected clients UI data processing and exchanging.

In my architecture I have a Server, which can have N Client Engines, which can have N clients.

Specifically, I am running into issues around the following scenario. I will use authentication as an example ( although it is a simple one but it gets the point across ).

A client ( Angular web client ) logs in via a websocket endpoint of a Jetty webserver. The message is forwarded to the queue of the Client engine. The client engine, when it processes the message, creates a request for the server and queues it up. The server, when it processes that message, performs the authentication. Now that response has to work its way back up the stack. The server has to queue a response message to the (right) Client Engine, then when the Client Engine processes that message, it has to send a message to the (right) client connection via the websocket endpoint.

Now this is all certainly possible and I have done it by just mapping the right information into the message and persisting that information inside each message until it gets back to the client.

However, this feels kinda clunky for me. I figured I am not the first person to have this problem. However, I don't think I understand what this problem is called because my search terms like: Async Programming, Client Server communication model, Client Server Server communication model, N-Tier communication model etc have not delivered on what I am looking for.

Is there a specific name for this problem?

I wanted to provide more details on the N-Tier system I have.

  • Tier 1 - Database Server ( data persistence ) 1 instance
  • Tier 2 - ApplicationServer ( in-memory solution ) 1 instance
  • Tier 3 - Delta Server ( delta forwarding to N Client Engines ) N instances
  • Tier 4 - Client Engine ( synchronizes data, session management, read-only transactions ) M instances
  • Tier 5 - Web Server ( Websocket Server ) M instances
  • Tier 6 - Client ( Angular Webapp )
هل كانت مفيدة؟

المحلول

It sounds like your central complaint is routing:

The server has to queue a response message to the (right) Client Engine, then when the Client Engine processes that message, it has to send a message to the (right) client connection

I have had good experiences with kafka channels, where a worker bee subscribes to a channel naming its responsibility, and sends its computed result to the next-stage channel. It scales flexibly as workers come and go. Clearly if you have C client frontends, you will need C distinct channels and will need to retain that channel name in the request as it hops from queue to queue.

Let your message queue infrastructure deal with your routing problems, rather than make your apps do much worrying about it.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى softwareengineering.stackexchange
scroll top