简体   繁体   中英

Arguments against deploying a monolith multiple times to emulate microservices

Our main API is a monolithic node application running on GAE.

There are a handful of endpoints that are long running and resource intensive that can cause performance degradation for the whole API. We've been thinking of turning those into micro services, but are pressed for time and would like to avoid spending a lot of developer time.

I thought a quick way to get similar benefits to microservices, but without the engineering overhead required to re-architect the service would be to simply deploy the app twice as different GAE services (default & secondary), and then put NGINX in front with a static set of rules directing requests for the slower url's to the secondary service.

That way the services can scale independently and if the secondary service is under load it won't affect key critical API's.

The only argument against this I can see is that it's slightly more resource intensive because we'll have the whole code base deployed when only a fraction of it is used, but that seems a small price to pay to be able to not have to spend a bunch of time extracting those parts into true micro-services.

Can anyone point to reasons why this would be a bad idea?

I actually did this for a little bit, because for a couple of endpoints i needed to run my main service as the biggest instance size.

It did work, but I eventually took it down. There were a few things that were less that fantastic about it.

It ended up being a little confusing since i didnt make changes to it (and thus didn't deploy to it) as often as my main service, so it would sometimes have issues like old versions of util functions that I had patched but didnt realize that my secondary service used so i didnt deploy it there, so you get these dejavue moments.

It also becomes easy to accidentally run cloud tasks on the wrong service since i was specifying service for several tasks when enqueuing.

also you can use a dispatch.yaml for routing https://cloud.google.com/appengine/docs/standard/python3/reference/dispatch-yaml

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM