Live data from Hacker News

Why we ditched Django for Microservices

blog.hubblehq.com

71–80 of 85 posts

Re: Why we ditched Django for Microservices

#71

Earlier quoted context omitted.

Of course Django can be used for microservices I don't recommend it, but you can use it I would prefer to use Django mainly for CMS kind of things

Why?

My own reasons: because Django is awesome as long as you want to do everything the Django way. For example, as soon as you want to upgrade to SQLAlchemy because every other business unit is already using it, you're in for pain. You can unwire some of those low-level decisions and plug your own code it, but with all the difficulty that usually brings, what's the point of using Django in the first place?

Django was born as a CMS and it really excels there, but it's modeled as a complete end-to-end stack. That's great if you love every single component of that stack, but not so great if you'd prefer alternatives.

Re: Why we ditched Django for Microservices

#72
It's amazing how easily people swap "I can't see how to use this in the contexts I'm familiar with" to "it doesn't make any sense at all".

Being myself - just a few years ago - a long time strong proponent of tightly coupled monoliths, I can't believe how blind and foolish I was in my fundamentalist rejection of loosely coupled architectures.

Monoliths do just fine up to a certain level of structural complexity. Above that, asynchronous service-like architectures are the only viable way to go.

Microservices is an attempt to see if the services patterns work below that waterline, down to the function level. That's why I find microservices at least interesting.

At any rate, it's a cost/benefit balance game, not an ideology.

Edit: clarity.

Re: Why we ditched Django for Microservices

#73
post #53

Earlier quoted context omitted.

Using Django Rest Framework is practically the EASIEST tool for building microservices I've ever used. It's incredible how awesome it is for building APIs. We were recently looking at building out some new services in Flask or Express. We compared the advantages of each to DRF and quickly concluded that it wasn't worth it. DRF has so much commonly used stuff done for you and it sets up one of the best standards for R…

Flask is so minimal. Curious what were the disadvantages that weighed against chosing Flask.

DRF includes all the serialization and loose object structure for you to build off of.

We've been using DRF pretty seriously for over a year and have yet to find a feature that we want that isn't already implemented or easy to implement on top of it.

Re: Why we ditched Django for Microservices

#74

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 ?

One approach that makes sense in an enterprisy way is to use an ESB. BPEL can help here. Your ruby app calls the ESB on a service. Behind the scenes the ESB composes the calls efficiently into a final product for you. The enterprise system bus will aggregate the parts into a useable whole defined by your domain.

A benefit of this is that people get a unified view of the system. You can pull parts as needed. You can survive partial outages better than a monolithic app.

Of course you can still call each of the services independently. The ESB is just another tool in your box.

Re: Why we ditched Django for Microservices

#75
post #46
post #10

Earlier quoted context omitted.

That's a good reason to have shared responsibility of code. There is no one owner of a codebase, an entire team should own the code. An entire team leaving at once seems highly unlikely.

Yeah, but that's harder when everyone knows Erlang, and one guy goes off and writes something with, say, Django for fun.

But if someone goes "lone wolf" and writes an application in a language he or she chose without informing other members of the team/organisation something else might be going wrong in the chain.

I get the idea you're trying to convey here but in the case of a well-organised team/organisation that won't really fly as everyone will be involved at some point and choices are being made together.

Re: Why we ditched Django for Microservices

#76
I've been a big fan of microservices for years. I believe that a good microservice has a lot in common with traditional Unix commands. And I find it funny that no one here has gone off on a tangent to talk about how horrible those are.

Unix's tools and good microservices have the following things in common:

1. They are small 2. They are loosely coupled 3. Shared-nothing state 4. They enforce standards for consuming and emitting data 5. They enforce a single standard for piping data from one process to another.

That said, I strongly believe that this won't work for every class of problem. And while I may be putting words into Tom Watson's mouth here, I believe he would say the same. But hey, guess what? This WOULD work for quite a few problems!

Some of the sentiment in the comments here feel defensive and knee-jerk. And I don't understand why. Tom Watson isn't telling you that you should use microservices. He's only explaining why he's using it at Hubble. I'm pretty sure how it turns out is going to have no impact on anyone else here, except (obviously) his customers.

But I hope it succeeds. I think there's a lot we can learn by applying the lessons Unix taught us to web-scale utilities.

Re: Why we ditched Django for Microservices

#77
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.

Re: Why we ditched Django for Microservices

#78

Earlier quoted context omitted.

Sure, but the title says "ditching Django" ... presumably if they have a Django monolith, at least some of the devs might choose Django for some of the microservices? Maybe they are still using Django in some capacity and the title is just slightly overstated ... not sure, but would appreciate an author comment in this regard.

Yes you're right it is slightly overstated. We still use our Django monolith to compensate for not re-writing every single part of our codebase. However overtime I would imagine we would move away from Django as with small enough services it would be overkill as a solution. Saying that, if it makes sense at the time then why not. With this architecture you have the flexibility to do that.

Sure -- not looking to nitpick. I just wanted to understand if there was something about Django that you found incompatible w/ microservices, and it sounds like there isn't.

An overstated headline isn't the worst crime on the planet (though, I would say that Google has already carried the headline far and wide already ... sigh).

Re: Why we ditched Django for Microservices

#79

I've been a big fan of microservices for years. I believe that a good microservice has a lot in common with traditional Unix commands. And I find it funny that no one here has gone off on a tangent to talk about how horrible those are. Unix's tools and good microservices have the following things in common: 1. They are small 2. They are loosely coupled 3. Shared-nothing state 4. They enforce standards for consuming a…

1. They are small 2. They are loosely coupled 3. Shared-nothing state 4. They enforce standards for consuming and emitting data 5. They enforce a single standard for piping data from one process to another.

This can all be done via libraries with clear APIs, with none of the deployment headache of a microservice.

Re: Why we ditched Django for Microservices

#80
post #16

Earlier quoted context omitted.

[deleted]

Correct, writing code does not make money. However this change is a little bit like starting a blog... You don't see the immediate benefits straight out but you'll realise them over time. You can put it off and put it off but the longer you do the harder it gets, especially in this scenario. This architecture doesn't make sense for everyone and we could have continued with Django. But making these changes now mean th…

Don't take this the wrong way, but you have 3 people writing code right now according to your Team page on the website.

Isn't it way more confusing to have a bunch of different code repos that only a single person owns? Sounds to me like you'll be locking up too much code in a single individual's head. Not to mention if they're using different frameworks and libraries you're only going to add to the headache.

For smaller teams, it usually is best to stick with one or two codebases/languages for your backend. Sure there are often "better" tools for specific applications but at the end of the day there's usually a way to handle them with your existing codebase that will let you scale for now.

As an example, we needed a robust messaging framework to support our chatrooms and private messaging features. We originally built it out in Tornado, then switched to NodeJS with a rabbitMQ backend, and finally realized it was easier for us to just use PubNub and fire off the pushes from our main Django app. It'll scale with us for probably 10x our current size and by that time we'd have a team of 4-5 people dedicated just to this feature anyways.

Post reply on HN