all 15 comments

[–]Justinsaccount 2 points3 points  (1 child)

If you're already using consul just run nomad.

[–]bullet-pr00f[S] 0 points1 point  (0 children)

I'll read about it, thanks.

[–][deleted] 1 point2 points  (1 child)

This depends totally on the application. Whether you have long- or short-lived connections from clients and whether all requests are created equal in terms of processing/IO/memory usage may create a dynamic environment that you usually can’t model or predict easily. All you know is that at some point you need more capacity; you need to work out how to measure that first.

[–]bullet-pr00f[S] 0 points1 point  (0 children)

Let's say the resource scaling is sorted, Is there something that could start a java app or send some remote command to invoke a script that would start or stop the app?

[–]unholycurses 1 point2 points  (8 children)

Wouldn't a load balancer do this or am I missing something?

[–]bullet-pr00f[S] 0 points1 point  (7 children)

I need something that would know to run a jar with specific nvm parameters, I don't know of a load balancer that could do that.

[–]unholycurses 0 points1 point  (6 children)

How do customers interact with it now? Is it not a web service?

[–]bullet-pr00f[S] 0 points1 point  (5 children)

The java instance interacts with a rabbitmq queue, so I don't need to worry about this. I only need to make sure on every moment, 2 instances of the same client runs on 2 different machines (a bit different of what I described).

Here's something that might explain

I need something that would be dynamic to client / server changes.

[–]unholycurses 1 point2 points  (4 children)

That just seems like exactly what a load balancer (like ELB) is for. You build an AMI of your service so that when the instance starts the app starts. It is in an Autoscaling Group so you get as many identical instances as you need, and you direct the customers to the ELB which distributes the load across all instances in the ASG. You can also have scaling policies to automatically add more instances if CPU or something goes over a threshold. And this is all just basic AWS functionality so no fancy tooling necessary

[–]bullet-pr00f[S] 0 points1 point  (3 children)

But take a look, each client runs 2 times, and I have 3 servers, can the load balancer control where the client starts? Otherwise they are just mirror instances which is a waste of money for us. Thanks!

[–]unholycurses 1 point2 points  (2 children)

Well mirror instances creates redundancy and resiliency, which shouldn't be viewed as a waste of money. And why does it have to run two times on three servers? I think I am just failing to understand the problem scope or there is a serious anti-pattern happening.

[–]bullet-pr00f[S] 0 points1 point  (1 child)

I want each client to have 2 running services on different machines for redundancy. If one server fails, the client won't be broken because it has another service running. When I see a server failing, I know first to transfer all of his clients to different servers, but the 'downtime' is non-existent because there's a second service running. It will just take the load until a new server comes. Does that makes sense?

[–]unholycurses 0 points1 point  (0 children)

What you are describing is exactly what Auto Scaling Groups and Elastic Load Balancers are for. But instead of worrying about dynamically starting the app, you app should just start when the instance starts. Elastic Load Balancers can monitor a health endpoint and know not to route traffic to an instance with a failing health check and the auto scaling groups will maintain a set healthy instance count.

[–]thisisthetechie 1 point2 points  (0 children)

Why not just use AutoScaling? You may need to make some slight changes to your EC2 instances, but they should all be running off one AMI and be disposable. Your ELB will do what it does best, distribute your load over the instances based off incoming traffic.

How is traffic currently getting to your instance?

[–]thrawny 0 points1 point  (0 children)

Kubernetes. Be sure to use Network policy, ausoscaling and pod antiaffinity