Question regarding microservice

Hello, I have a question related to microservices, the question would be:

can I have 2 backend parse-server + express

and divide the backend into microservices?

That is, on one parse-server you have the auth and on another parse-server you have the AI? and in another the db, and in another the clouds?

Theoretically, you can use Parse Server in a microservices design and split it into different functions. For example, one service can handle authentication, another service can handle ai, another service can handle de, and another service can handle cloud code.
However, you will be responsible for communication and data consistency about each service.

1 Like

Thank you very much for your response, and your time, sorry, if it is not abuse, are you not aware of any documentation? or any guide to apply it? or where could I start? please. thanks a lot.

Your suggestion of splitting vertical layers of Parse Server, as in “you have the auth, (…) another the db, and in another the clouds” does not seems to make much sense in the context of Parse Server.

For example, if a Cloud Function that contains a query is executed, the request will go to the Cloud Code endpoint, validate through auth and then communicate with the DB. It involves all 3 of the layers you mentioned above.

What you could do it to split up horizontally. For example, if you have 2 Cloud Code functions, you could run function 1 only on Parse Server instance A, and function 2 only on Parse Server instance B. The request routing would determine to which server instance (or microservice) you are sending the request. That routing is outside the scope of Parse Server - naturally - because it needs to happen before the request reaches the server.

Through routing you could split Parse Server endpoints (/login ,/hooks, etc) into different microservices, or if you have a more fine grained routing, you could split by geographic origin or request header fields. But again this is a feature of your cloud environment, not of Parse Server.

1 Like

Of course I understand… and what you are telling me is true… but I only put it as an example of what a microservice is like, I don’t speak native English and I don’t know if my words are correct to explain or make myself understood, sorry For this reason… I mean that if I add certain AI functionality to a cloud… how could I divide it in relation to what you mention… that is, a guide to what you mention… I am new to that part and I want to run an AI within a cloud… if several users make requests to this cloud… would the performance be affected? How can I measure the performance of the back? with pm2? I learned about parse server through moralis and I continue studying and I hope to soon be able to contribute to the community with an adapter that I work on… thank you for your time. and grateful for your response… it also served as a guide for me. You mentioned important things.

To scale your server resources according to the request volume you would use a cluster of Parse Server behind a load balancer. That cluster would scale up and down based on parameters you define depending on the nature of you application, for example CPU usage or memory usage or response time.

If these metrics are needed to scale up and down they are usually recorded and made available to you to evaluate performance.

Scaling and metrics collection are not features of Parse Server. If you deploy Parse Server in a Cloud Service environment then the service provider will have documentation where you can learn more about these services.