Demo for the talk “Distributed Systems with Rack”
This is the complete code for my Scottish Ruby Conference talk. It demonstrates the idea of having a website generated by multiple distinct and distributed services. For the purposes of the demo, we have a server application which assigns roles to computers that connect. In reality, you’d probably have a legitimate proxy server sit in front of the clusters of nodes…
In our case though, we keep a list of clients that are connected, and which roles they’ve been assigned to. When we want to generate a page, we determine which roles are necessary, pick one of the clients from each role at random, and use Nginx to combine the results into a single page.
Client Startup
ruby client.rb 1.2.3.4:9876
Server Startup
nginx -c /path/to/distributed_demo/nginx/nginx.conf ruby server.rb 9876
Cheers,
Tyler