concurrency - Writing scaleable code -
can describe in simple terms how scale service (lets assume service simple , function x() ).
to make scalable fire off new node (upto maximum depending on hardware) each client wants run x?
so if had 4 hardware boxes, may fire 4 nodes run service x(), on 5th client request run x() on first node, 6th client on second node etc?
following on this, know how spawn processes locally, how both 1st , 5th clients use same node 1- spawning process remotely on node client each time?
any simple examples welcome!
this depends on x is. if x independent, instance x() -> 37.
don't need connect nodes. place standard load balancer in front of system (haproxy, varnish, etc) , forget kind of distributed communication. in fact, there no need use erlang that. replace erlang other language of choice. equally good.
where erlang shines when several x functions have dependencies on each others result , when x might live on physical machine. in case erlang can communicate other x seamlessly, if lives on different node.
if want implement round-robin scheme in erlang, easiest way have single point of entry , let forward requests out multiple nodes. bad if there pattern node ends long-running processes. need build mechanism of feedback know how weight round-robin queue.
Comments
Post a Comment