Hi fellow lemmings,

currently, I am working on a small project, where I am in need of some help. My project consists of multiple services, that depend on each other. The stack consists of front-end, middle-tier & back-end/database. To get a detailed answer, I try to formulate my question thoroughly.

Front-end:

On top of the stack are running two services. Both of them need to access the DB via a middle-tier.

Web service & API

One service will offer the web interface & the REST API for automated services. It will be hosted by a python web service. The skeleton for this part is mainly done. The service needs to communicate with the middle tier to manage user actions.

Executor service

A second service of the front-end will manage the executing part of the service and interacts with the internet. It will be written in python as well. The service needs to communicate with the middle tier to get the instructions it’s supposed to execute.

Middle tier

The middle tier will act as a interface between the front-end services & the database. I’d like to implement it in C. The service is supposed to receive input from the front-end services, process it and access the database. Further features are planned but not necessary for the first release.

Back-end/Database

The back-end will be the database system. It should only be accessed by the middle tier (preferably with a connection pool).

As far as I planned the project, I intend to run the front-end and the middle tier services on the same machine.

Question Section

Well, if you read everything until here, you are probably willing to help. I am done with the skeleton for the front-ends, I am done with the table structure for the back-end. Also, the communication from the middle-tier to the database won’t be a problem. But I am struggling a bit with the communication between the front-end services and the middle-tier. What is common practice to communicate between a C service and Python services?

My ideas is to make use of common network approaches. For instance, could I host a REST service on the middle tier as well. This raises some fears, because I think this will be the bottle neck in terms of performance. Can you confirm? Alternatively, I was thinking of other IPC features like Unix Message Queues or system sockets. The latter one seems to be my favorite solution.

Unfortunately, I don’t have too much experience with inter process communication and would like to ask for your advice. How would you solve my problem?

Thank you very much for an answer.

Yours rr

  • nutomicA
    link
    fedilink
    arrow-up
    1
    ·
    5 years ago

    Well you need to create some kind of API to communicate between these services, and then you probably need to document this API and keep it stable. Whats the problem with having multiple database connections? Thats what databases are made for.

    • randomrhinoOP
      link
      fedilink
      arrow-up
      1
      ·
      5 years ago

      I will use multiple database connections. But I want to have a single service in the middle. Why is it so hard to understand? Isn’t modularity an achievable characteristic for a service? I will use multiple domains. And each domain will have their own service hosted. Since, all domains need to access the same data, I just like to use a middle tier for it. It makes sense, because I just need one configuration for the middle tier. I don’t want to maintain the same configuration for multiple services.