Live data from Hacker News

Behind a Backend-as-a-Service Provider: The How and Why of Our Architecture.

spire.io

11–20 of 35 posts

Re: Behind a Backend-as-a-Service Provider: The How and Why of Our Architecture.

#12
post #3
post #2

I saw a presentation on it last night and it looked pretty awesome. We're planning to use their Messaging API in our upcoming project.

Cool. What are you planning to build, if you don't mind me asking?

One of our client projects involves having customer service staff talk and resolve payment issues with paying users. The messaging API means we have one less thing to worry about, allowing us to focus on handling payment resolution rather than the communication side of things.

Re: Behind a Backend-as-a-Service Provider: The How and Why of Our Architecture.

#16
post #14
post #6

Earlier quoted context omitted.

Seconded. Nothing happens when I click join, and there is an error "no zlib library" in the console.

Thanks. It should be alright now.

I get a 405 Method not allowed after filling in my name. Opera 11.61, Win 7.

Re: Behind a Backend-as-a-Service Provider: The How and Why of Our Architecture.

#17
post #7

Full disclosure, I'm heading up the backend development for Zipline Games Moai Cloud ( http://getmoai.com/ ). We're targeting game developers so that lead us to some different use cases and language choices (like Lua). Thanks for sharing this, at first read through it sounds a lot like the architecture mongrel2 provides (which we use). If you were to swap out the node.js dispatcher with mongrel2 and the redis queue w…

Regarding the architectural question:

We actually tested a few designs using m2 and 0mq during our R&D phase. 0mq's push/pull sockets provide the same "take" behavior as the Redis RPUSH/BLPOP, so we definitely could have used m2 as the HTTP end of a similar architecture to what we use now.

One of the considerations that led to the choice of Redis was the transparency of the queueing and dequeueing. The messages in the queue are easily inspected, and the Redis MONITOR command helps greatly in debugging.

More important from a design perspective was our desire to hide the HTTP specifics from the workers. m2 pushes a JSON or tnetstring representation of the HTTP request to its workers, but we want the task we send to the workers to be generalized, stripped of information that is only meaningful for HTTP. We also want to classify the task by resource type and requested action, which allows us to use multiple queues. Multiple queues allows us to implement workers on an ad hoc basis.

M2 could work here if our request classification only depended on the URL. But that is a limitation we are not willing to accept. Request headers can be very useful in dispatching, especially those related to content negotiation (Accept, Content-Type, etc.)

There is an interesting hybrid approach using mongrel2: write one or more m2 handlers that perform the same function as our node.js dispatchers. I.e. m2 sends the JSON-formatted request to an m2 handler that deserializes it, removes the HTTP dressing, classifies the request according to type and action, then queues a task in the appropriate queue. A worker takes the task, does its own little thing, and sends the result to an m2 handler that knows how to re-clothe the result as an HTTP response and deliver it to the m2 cluster.

Regarding the question about queue behavior across replicated Redises:

I do not know for certain, but I do certainly hope it is not possible for an item in a Redis list to be popped by more than one client, no matter how the replication is configured.

With our architecture, we could relieve at least some of the strain on the task/result messaging system by using a cluster of Redis servers for the task queues. Each queue server might have its own cadre of workers listening for tasks. The return trip (getting a result from a worker back to the HTTP front end) is a little trickier, because it matters which HTTP server is holding open the HTTP connection. You could use PUB/SUB (which I believe is how m2 currently does it), or each HTTP server could be popping results from its own result queue.

When using a single Redis server, the only hard limitation we have seen with using the BLPOP operation is the number of client connections Redis can keep open. In case it's not clear, the BLPOP is blocking for the client, not the server.

Re: Behind a Backend-as-a-Service Provider: The How and Why of Our Architecture.

#18
post #10

Typo on the front page: We run our servers on Amazon Web Services and use their elastic load balancer (which is were we terminate SSL). which is _why_ (?)

We've been bitten by EC2 instances having issues accepting incoming connections (multiple HAProxy boxes in TCP mode to an STunnel cluster), and we've never had that issue in testing with ELB. ELB also beats our failover time when we lose an EC2 machine.

But ELB is in no way a permanent part of our infrastructure (nothing is permanent) especially as we move to supporting technologies such as SPDY on spire.io or, for example for the right customer requirement, SSL throughout the network stack. We're also fond of Stud running on our internal servers. I do think ELB is the right tool for our cloud today.

Re: Behind a Backend-as-a-Service Provider: The How and Why of Our Architecture.

#19
post #7

Full disclosure, I'm heading up the backend development for Zipline Games Moai Cloud ( http://getmoai.com/ ). We're targeting game developers so that lead us to some different use cases and language choices (like Lua). Thanks for sharing this, at first read through it sounds a lot like the architecture mongrel2 provides (which we use). If you were to swap out the node.js dispatcher with mongrel2 and the redis queue w…

Regarding the architectural question: We actually tested a few designs using m2 and 0mq during our R&D phase. 0mq's push/pull sockets provide the same "take" behavior as the Redis RPUSH/BLPOP, so we definitely could have used m2 as the HTTP end of a similar architecture to what we use now. One of the considerations that led to the choice of Redis was the transparency of the queueing and dequeueing. The messages in th…

Nice post.

Do you do anything special to make the queue which your workers are BLPOPing durable?

Is there a reason you didn't use Redis pub/sub? Seems like the perfect use case.

Re: Behind a Backend-as-a-Service Provider: The How and Why of Our Architecture.

#20
post #10

Typo on the front page: We run our servers on Amazon Web Services and use their elastic load balancer (which is were we terminate SSL). which is _why_ (?)

We've been bitten by EC2 instances having issues accepting incoming connections (multiple HAProxy boxes in TCP mode to an STunnel cluster), and we've never had that issue in testing with ELB. ELB also beats our failover time when we lose an EC2 machine. But ELB is in no way a permanent part of our infrastructure (nothing is permanent) especially as we move to supporting technologies such as SPDY on spire.io or, for e…

Haven't you run into performance terminating SSL on ELB? For me the performance is so-so, as I'm using a 2048 bit key and it seems I hit the maximum requests per second limit pretty fast. There're a pair of threads regarding this issue on the AWS forums, where a user did a really exhaustive test of ELB and even got an Amazon engineer to really look into that issue:

https://forums.aws.amazon.com/thread.jspa?messageID=327283 https://forums.aws.amazon.com/thread.jspa?messageID=327715

Post reply on HN