2 ms·
I think this overcomplicates the problem. I have not written a high performance messaging system in PHP, but I have in both C and Ruby, and the quip about a "su
by vidarh 9y ago
I think this overcomplicates the problem. I have not written a high performance messaging system in PHP, but I have in both C and Ruby, and the quip about a "sufficient complicated concurrent program" was moot in both cases, because
1) there are plenty of approaches to doing this cleanly without writing a "complicated concurrent program" - here's one (I've done this in production; it worked great and all the work on federation has been done for you): use qmail or the qmail approach, of decomposing into small independent programs, and of which case crash and get restarted without causing any damage. Incidentally, yes, this depends on process isolation just like you'd expect with PHP, and yes, this is run of the mill stuff you can do with anything. That's the point - Whatsapp like message exchange is not rocket science, and how to structure this so you can just let processes die is something we solved literally decades ago.
2) even if you write a concurrent program to handle the queuing, the logic is simple enough that e.g. my first production queuing messaging system in Ruby was <700 lines of code, with ~10 lines protected by a Mutex making up the only place where the threads interacted with each other at all.
I'm sure there are many spaces where Erlang could make a huge difference here. And as I said it's very much possible it'd have a performance impact, but this specific example isn't a complicated problem space. At all.