lundi 2 février 2015

AWS: conditional route to EC2 depending on content

I want to build a cluster of EC2 "worker" instances where each EC2 should handle particular shard of users, lets say:



  • EC2-1 handles users-1-2-3

  • EC2-2 handles users-4-5-6

  • EC2-3 handles users-7-8-9


So that when user-3 tries to login and execute other requests in my service, each request from that user always gets directed to the same EC2-1, so that I can have all information related to specific user hosted on one machine, in heap (to reduce the load on database and avoid complex queries from different partitions, but that's different story).


what is the best way to do this in Amazon?


I guess, for that I need to maintain some kind of mapping table (userId <-> instanceIp). One option I thought about is having additional "routing" EC2 instance (or cluster of at least 2 of them, for failover, fronted by ELB) which only manages redirects to "worker" instances (in the same region) according to such mapping table and keeps the table updated (probably, each "worker" instance should somehow report that its up and running and managing users-X-Y-Z).


But maybe there is a way to do it via Amazon services without additional "routing" EC2? I've read some docs about VPC, Route53 and Geo routing, but the closest thing I could find was http://ift.tt/1LEyAHU but I'm not sure if this is the right thing, because there could be millions of users on each "worker" EC2 and I don't know it works for dynamic content such as user ids.


yeah and I hope it will be like 2 millions of users per worker EC2...


Aucun commentaire:

Enregistrer un commentaire