I want to synchronize messages between several application instances on amazon beanstalk. Every instance must be able to send messages to all other instances without knowing them. So I thought I build a publish/subscribe pattern with SNS and SQS.
When a new application instance is starting, it creates a new SQS queue and subscribes to the topic. So far, so good. But what if the autoscaler shuts down an instance?
Is there any possibility to catch the shutdown event? Or do you have any Ideas for other implementations?
You sound like you would be well-served by existing metrics that you can set alarms with via CloudWatch, or by making your own custom metrics. For example, each EC2 instance has several metrics to monitor recurring Status Checks. You can define alarms that will send out notifications to subscribers based on their state. An instance that fails a Status Check for more than X minutes may be worth investigating... which could happen automatically if you have an application monitoring alarms.
If that isn't quite narrow enough for you, I would encourage you to check out custom metrics. You could create your own metrics and alarm to (for example) ping your applications per-instance to make sure they're responsive before synchronizing the messages. Alarms have three states: "OK", "ALARM", and "INSUFFICIENT DATA" that you can listen for and respond appropriately. So for example, if your metric polled on the same instance as the application and the instance went down, you would start getting "INSUFFICIENT DATA" messages.
Custom metrics have been helpful for me before as a simple application monitor... report a 1 or a 0 if I can ping my application every so often. Send a notification if the ping fails, send a notification if there is insufficient data. Worked great.
I want to synchronize messages between several application instances on amazon beanstalk. Every instance must be able to send messages to all other instances without knowing them. So I thought I build a publish/subscribe pattern with SNS and SQS.
When a new application instance is starting, it creates a new SQS queue and subscribes to the topic. So far, so good. But what if the autoscaler shuts down an instance?
Is there any possibility to catch the shutdown event? Or do you have any Ideas for other implementations?
You sound like you would be well-served by existing metrics that you can set alarms with via CloudWatch, or by making your own custom metrics. For example, each EC2 instance has several metrics to monitor recurring Status Checks. You can define alarms that will send out notifications to subscribers based on their state. An instance that fails a Status Check for more than X minutes may be worth investigating... which could happen automatically if you have an application monitoring alarms.
If that isn't quite narrow enough for you, I would encourage you to check out custom metrics. You could create your own metrics and alarm to (for example) ping your applications per-instance to make sure they're responsive before synchronizing the messages. Alarms have three states: "OK", "ALARM", and "INSUFFICIENT DATA" that you can listen for and respond appropriately. So for example, if your metric polled on the same instance as the application and the instance went down, you would start getting "INSUFFICIENT DATA" messages.
Custom metrics have been helpful for me before as a simple application monitor... report a 1 or a 0 if I can ping my application every so often. Send a notification if the ping fails, send a notification if there is insufficient data. Worked great.
0 commentaires:
Enregistrer un commentaire