Live data from Hacker News

Why we ditched Django for Microservices

blog.hubblehq.com

81–85 of 85 posts

Re: Why we ditched Django for Microservices

#81

Earlier quoted context omitted.

And of course, ignoring the problem of duct-taping all the services together. "Oh we'll just RabbitMQ everything together", sure, great, until you discovered certain services needed a smaller latency, more bandwidth, etc And RabbitMQ libraries are a pain and are not smart

actually this is a question that I have - how do you render the final output ? I mean lets say I request a web page which depends on 5 microservices. What happens ? does rails or whatver block till all five have returned the output - or do you use something like ESI ... how are the microservices composed finally ?

Adopting a microservice architecture does nothing to define how you "render your output"- the devil is still in the details, but that is why a microservice is so interesting and flexible.

The way you will tackle this will largely depend on many questions like what services are safe to be exposed publicly, what services are dependant on other services, do you have a public API?

For example, you could have a public facing API on each service, or endpoints that render HTML templates. The services may or may not talk amongst themselves, either via the same public API, or a private one. If you make a request to one of the services, and that service needs to make a request to another service to generate the response, you've got to make a call on whether you want a blocking or non-blocking approach. Consider:

1) Blocking until the other services have responded

2) Pinging the server to check when it's done

3) Using web sockets

4) Whatever the hell else you can think of

Alternatively, you might want not want to expose your services publicly, and choose to have a single service that talks to the services on the clients behalf, a middleman. Your client speaks to this service, and the service sends of various requests to the other services. But the problem still stands. To block, or not to block?

AFAIK some big names like Amazon, Spotify, (Twitter?) have multiple public services. You may sometimes notice individual components on their [web] applications failing without bringing down the whole site, since the failures are isolated to the different services. Neat, huh?

Re: Why we ditched Django for Microservices

#82

This makes no sense from a business perspective. Letting developers work using any languages and technologies sounds like a good idea to individual developers maybe but how do you intend to maintain it? If you stick to a few core languages and technologies and hire / train for those tech then you reduce your risk if one or more developers leave and reduce the total complexity of your stack. You should have a good rea…

There is absolutely no need to use different languages and technologies within a microservices architecture if it is not necessary for your business. But to simply dismiss the business perspective from your perspective seems a little naive.

Some reasons why decoupling your architecture can make sense from a business perspective:

- You have a complicated product, and wish to break it up into more digestible chunks, with allocated teams working on each abstract business concept (Amazon and Spotify do this).

- You want to avoid having a single point of failure- if one service fails, the rest of the system might well keep on working. (Ever noticed how sometimes a panel on Amazon doesn't load?). If you're running a continuous development process, stuff breaks, a lot. It's good if that's locked down.

- You have a business requirement to build something with a different technology (from experience- rendering javascript in a node service was much, much easier and more maintainable than with an existing Django app- we tried both.)

- You want to experiment with new technologies without changing your whole stack.

I'm pretty sure that the author wasn't talking about moving to microservices so they can blindly start building every aspect of the application in a different stack- but more that if they need to use a new technology for their business requirements, or want to give something a trial without committing, they can. And with the uncertainty and rate things change in modern software, and in a startup, that flexibility is invaluable.

Re: Why we ditched Django for Microservices

#83
Standardization is, generally, good for maintenance, learning curve and security, not always for retention (fun) though. Too much standardization is like the flip-side of too many one-offs: an extreme that can lead to unintended consequences. It's much easier to accrue technical debt and organizational bifurcation by having too many languages, with a big, painful shake out (technical debt repayment) into just a 2-3 (say Ruby|Python|Node & Go|Scala|Haskell|Erlang|C)... (I've seen this happen at a number of shops go through growing pains at scale).

Overall though, services should expose either a well/self-documented RESTful, zmq or similar API such that they can be rewritten in (your favorite whatever here). Being able to discover the API meta information automagically can be helpful for autogenerating clients.

The other aspect is that services have a risk budget: if the service is conventional and not as crucial, increase the experimentation. If the business/process model is risky/uncertain, use common, stable technologies.

(Gist: Pick from the toolbox, carefully... apply common-sense... Don't get stuck on perfect now or perfect waay later... Anticipate a little now to avoid pain of changing later.)

PS: Enterprise Rails is a great read. It's safe to ignore the Rails bits, because the architecture bits are universal and excellent.

Update: RESTful API metadata formats http://apiux.com/2013/04/09/rest-metadata-formats/ (and also https://en.wikipedia.org/wiki/HATEOAS )

Re: Why we ditched Django for Microservices

#84
post #69

Every time I see microservices, I think of Martin Fowler's First Law of Distributed Object Design: "Don't distribute your objects." http://martinfowler.com/bliki/FirstLaw.html Splitting your app into multiple apps that send each other HTTP requests or MQ messages seems likely to just make your app slower.

If speed is your only requirement, write the thing in assembly.

If speed is not a requirement, just write the thing in Django (or Rails)?

I'm just not compelled by the reasons the author gave for needing to switch from Django to microservices.

Re: Why we ditched Django for Microservices

#85

What about the headache of monitoring 10s of microservices, making sure they stay up and running and healthy? I assume that REST or Thrift (or something similar) is the way most microservices talk to each other. What if the latency isn't acceptable? I've thought about switching our architecture to microservices but these two potential issues are making me hesitate. How important are these issues in practice?

It depends on what you're building. For us, we haven't noticed any issues with latency just yet and there are plenty of steps you can take to optimise this down the line. As for monitoring there are plenty of tools to do that. You have bigger problems if you expect your services to go down often.

As for monitoring there are plenty of tools to do that. You have bigger problems if you expect your services to go down often.

Yes, even in your monolithic app, you probably used some tooling to monitor it. But now that single service being monitored has multiplied into 10-20 services being monitored.

Nobody expects their services to go down, but if you don't plan for it, then that means you haven't thought about high availability or disaster recovery enough.

Post reply on HN