According to this answer https://stackoverflow.com/a/41811770/2849613 I would like to get a little bit more information about best practices with microservices on Heroku.
The question is which approach is better?
Or
On my own I see already some pros and cons of both approaches:
Pros: better scalability (easy to create new machines for bigger load). Cons: communication between services goes "outside of heroku" in other words: because heroku app have public address everyone can connect directly to service (without going threw Eureka), because of that every services need to provide some authentication method and share it between each other - I think that this is risk prone.
Pros: easy to reproduce production environment for tests and develop (docker image), communication between services is done "internally" (image to image instead app to app). Cons: hard to scale (I think that load balancing between Heroku apps and then docker images is a little bit overhead).
Which approach is better? Maybe I can mix them together? Or maybe there is some different, better solution?
Do be honest the only thing which I am sure, is that I want to use rabbitMQ as a message queue...
Zuul 1 and Archaius 1 have both been superseded by later versions that are not backward compatible. The following Spring Cloud Netflix modules and corresponding starters will be placed into maintenance mode: spring-cloud-netflix-archaius. spring-cloud-netflix-hystrix-contract.
As we've seen, Zuul provides a single URL for all the instances of the Rest Service and does load balancing to forward the requests to one of the instances in round robin fashion.
Apigee, Eureka, Kong, HAProxy, and Istio are the most popular alternatives and competitors to Zuul.
We use Zuul at the entrypoint of all external traffic into Netflix's cloud services and we've started using it for routing internal traffic, as well. We deploy the same core but with a substantially reduced amount of functionality (i.e. fewer filters).
Thanks to Netflix and the Spring Cloud project, you can deploy a Zuul server on Heroku in just a few minutes. This service requires very little code, and can be used with microservices written in any language--not just Java. To begin, deploy the Heroku Zuul server demo project by clicking this button:
But thanks to the Spring Framework, it's easy to deploy Netflix OSS on Heroku while adhering to the principles of the Twelve Factor app and benefiting from Heroku’s first-class developer experience. In this article, you'll learn how to deploy Netflix's Eureka server to Heroku and connect your own microservice clients to it.
Load Balancing with Zuul When Zuul receives a request, it picks up one of the physical locations available and forwards requests to the actual service instance. The whole process of caching the location of the service instances and forwarding the request to the actual location is provided out of the box with no additional configurations needed.
Zuul is basically a JVM router and server-side load balancer provided by Netflix.The volume and diversity of Netflix API traffic sometimes results in production issues arising quickly and without warning. We need a system that allows us to rapidly change the behavior in order to react to these situations.
I prefer approach #1 (especially since I know you're using Heroku already).
Docker is great, but the benefits are very limited if you're deploying on Heroku. The reason why is that Heroku already does everything docker does: manage dependencies, installation, and process management. Heroku does all this already for you without the extra work of Docker-izing your environment.
Regarding the load balancing: it doesn't actually matter. In both of your cases, if you want to run on Heroku, you WILL be using the Heroku load balancer. This is because there is no way to 'bypass' that layer of the Heroku stack.
If you want to use Docker / zuul, you'll need to do that OUTSIDE of Heroku for sure. This means you need to do all sorts of other stuff, find a docker host, manage your own infrastructure, etc.
So, in my mind, #1 is a better option (if you're using Heroku) because:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With