Need clarifications on HA set up

16 views
Skip to first unread message

Loganathan Sellapa

unread,
Dec 3, 2014, 7:31:45 AM12/3/14
to bangal...@googlegroups.com
Hi All,

I have running rails 4 application with some scheduler jobs which will run on specific interval of time. 

Now I am planning to set HA for my application using HA proxy, in this scenario my application will be deployed on multiple servers with single the DB instance.

I know how to set up HA for my application, but I am not sure about the ways to handle the below scenarios in HA mode, can anybody give me the ideas to do it, also give me some ideas about different common HA problems which needs to be taken care by application code, thanks in advance.

1. How can we avoid running same rake tasks/ cron jobs on different servers, in my application I have the rake tasks which will run on specific time interval, if I set up HA then the same task will be running on multiple servers. I dont want to do it since the database is single instance only.

2. How can we handle the data duplication/ duplicate insertion (if the two application tries to create/update same record)


regards,
Loganathan
Mob: +91 7760780741 | +91 9944414388
Skype: loganathan.sellappa
ViewMe

Aakash Dharmadhikari

unread,
Dec 4, 2014, 2:22:08 AM12/4/14
to bangal...@googlegroups.com
Hello Loganathan,

I am not sure what HA proxy has anything to do with background jobs. But a standard setup for clusters looks as follows:

* One or more application servers with HA proxy hosted on the app master or a load balancer.
* One DB server + DB slave
* One or more Utility instances that are used for background jobs or cron tasks.

If you don't think you need a dedicated Utility instance then you can have the rate task running on one of the application servers. I am assuming that you have setup a cron job for this purpose. If not, what's the setup?

Also, I am not sure I understand what you meant two applications trying to update the same record. You have a single application deployed on multiple servers, right? Also, what kind of records you are talking about? If it's something like DelayedJob, the gem by default manages that by process level locking.

--
You received this message because you are subscribed to the Google Groups "BANGALORE RUG-Ruby Users Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bangalorerug+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mohit Thatte

unread,
Dec 4, 2014, 2:30:56 AM12/4/14
to bangal...@googlegroups.com
Hello Loganathan,

1. If you don't want to run the same task on multiple servers, then don't run it on multiple servers. This is unrelated to your HA setup. It depends on what strategy you use to deploy and setup your application.

2. Your models are responsible for consistency of data. So you need to figure out if you need to do an insert or an update and do that. Also (assuming you use a relational db), you can use database level constraints like primary keys, unique, not null  to ensure data consistency.

HTH,
Mohit


--
You received this message because you are subscribed to the Google Groups "BANGALORE RUG-Ruby Users Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bangalorerug...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
-Mohit Thatte

Loganathan Sellapa

unread,
Dec 4, 2014, 3:28:50 AM12/4/14
to bangal...@googlegroups.com

Hi Akash/Mohit,

Thanks for your suggestions, I have planned to go with db level constraints since I dont have separate instance for cronjobs.

Regards,
Logan

Sent from mobile device

Reply all
Reply to author
Forward
0 new messages