I have created a custom microservice and deployed in Mgt tenant and it has been subscribed by multiple tenant . Its getting lot of request to process from different tenant and seems to be ok on calculation side.
But it is starting very frequently like every hour .
I would suggest establish monitoring to understand why your microservice is restarting, though if it is being restarted it is more likely related to memory than CPU. We have an article describing best practices around monitoring:
which links to two articles that show how to do monitoring for Python and Java microservices.
The frequent restart of your microservice could have multiple reasons, most likely an out-of-memory issue or non-catched exception that is exiting the whole microservice.
Also as Harald suggested I would analyze the issue in more detail before taking any action. If you just increase the memory but still have a memory leak it is just a matter of time until the microservice will again run ouf-of-memory. Better would be to optimize the implementation to consume less resources e.g. async logic or releasing references to objects that are not needed any more and can be unloaded from memory.