3 ms·
This is a non-trivial problem, assuming they really do want this to be a network server. For instance, it did not specify if they wanted "at most once vs at lea
by lastofus 11y ago
This is a non-trivial problem, assuming they really do want this to be a network server. For instance, it did not specify if they wanted "at most once vs at least once" delivery specifications (I'm guessing they wanted to see if you have come across this). Dealing with reliability in the face of failing network connections takes some serious thought.
One thing I may have pushed back on is "the requirements say this should be thread safe, but it does not say it must use threading. Can the server be single threaded?". If they are ok with that, writing an async IO server in a language geared for it would make things a bit easier (Erlang, Go, Python + Gevent, Node, etc). If feeling cheeky, you could ask if you just write a basic server sitting in front of Redis or using 0mq since the specs did not explicitly disallow 3rd party libs or apps.
At the end of the day, this may be one of those problems where they see how far you get, and don't expect most candidates to finish in 60 mins. It could also just be not the best test question relevant to the job you were applying for. I think it's fair game for anyone w/ previous experience writing low level networking code and servers from scratch, which is generally not what PHP/Rails devs are doing.
- sage76 11y agoIf by at most once, you mean all the subscribers get the message once and once only, yes, that's what they wanted. I tried this in java anyway and didn't get very far. Defined the classes for publisher, consumer and queue. Then was grilled about the reliability and all the other requirements.
- lastofus 11y agoIf they required of you to implement once-and-only-once reliable delivery of messages over a network, then I would argue they don't really understand the problem themselves. This blog post does a pretty good job of describing the problem: http://bravenewgeek.com/you-cannot-have-exactly-once-delivery/ http://bravenewgeek.com/you-cannot-have-exactly-once-deliver... I would not feel bad about missing this question. Distributed systems are hard!