Live data from Hacker News

Why we ditched Django for Microservices

blog.hubblehq.com

31–40 of 85 posts

Re: Why we ditched Django for Microservices

#31
post #28

I don't get it: why does moving to microservices mean ditching Django? Couldn't you take your Django monolith and break it into separate (still-Django) microservices? I get that Django is seen as "too heavyweight" to do such a thing, though there are literally books ( http://shop.oreilly.com/product/0636920032502.do ) written about how to slim down Django. I get that monolith to microservice is all the rage these day…

Seconding this. Could someone clarify? I thought Django and "microservices" are orthogonal. Can't Django be used to create any service, even a micro service? I certainly used Django in the past just as a REST server, without any "web site" to speak of. It just reduces some boiler plate.

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

Re: Why we ditched Django for Microservices

#32
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 reason for introducing a new language or technology to your stack and think carefully before diving in. Just create separate Django apps and only switch to a different tech if Django is particularly ill suited for the task.

Re: Why we ditched Django for Microservices

#33
Can I be the first to say that this is a terrible idea?

>We have a multitude of parts that each could easily be self contained as their own service. For example: Messaging, Search, Authentication, etc. These all have different requirements and focuses and therefore lend themselves better to different languages.

Yeah, not really. Python is not inherently less suitable for authentication than, say, Java. Both languages are designed for general purpose programming. The only real drawback to python is that it is relatively slow and this isn't even likely to be an issue at all if you are using django (you'll most likely bottleneck on I/O).

>Also, looking at our roadmap, we have lots of sprints and projects coming up that could be implemented in their own silos. By splitting these into services this allows us to quickly test and iterate without worrying about the rest of our product.

And splitting them into separate libraries is not sufficient because?

>Whereas in a monolithic system these services are bundled together and can create a spaghetti mess of workarounds and packages.

Newsflash: you're MORE likely to make a spaghetti mess of workarounds if you use a microservices architecture because of the impedance mismatch between API layers. You'll have to create a representation of, say, a user object on both sides of the microservice divide and write code to serialize it and deserialize it. Hello massive code repetition and obscure bugs.

>Having been a dev team of 1 for a long time I'd never experienced the headache of installing all the dependencies required by our Django system. It never really occurred to me that as I installed more packages, it was becoming incrementally larger and more complicated for new team members.

If you think your headache is bad with django (which has consistent opinions - e.g. on how templates should work - that makes it possible for modules to work together), get ready for a nightmare when you start using a hodgepodge of different systems written in different languages.

>We don't worry too much about code quality

This has officially moved this blog post from bad idea to outright parody.

>However, most of the cons are part and parcel with programming.

Here's a small laundry list of the exciting issues you'll now get to deal with:

* Writing serializers and deserializers for your objects so they can be passed from one service to another. And debugging them!

* Babysitting all the new services you will need. You'll need to keep them up and running, monitor them, have a backup plan for all of them going down and lots of lovely extra error conditions.

* The headache of trying to figure out how to scale your network of microservices - probably meaning lots of time configuring load balancers.

And much, much more.

Re: Why we ditched Django for Microservices

#34
post #11

Doesn't Django already encourage this type of design? Each Django project is composed of several installed 'apps'. Each app should be portable enough that it could be the only app in any project.

True, but all these installed apps still increase the size of your one project which becomes larger and larger. You can't install it in parts, you can't make any architectural or language changes as it requires a rewrite of the whole project and each new release/ deploy effects the entire codebase. Microservices doesn't fix everything and you're right about Django encouraging this type of design. Each approach has it…

You can easily have a Django app which calls a micro service.

Re: Why we ditched Django for Microservices

#35

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…

My thoughts as well. It seems like the problem here wasn't "monolithic Django codebase". The author mentions that he had a lot of trouble getting new developers up to speed because of package requirements.

That should be the simplest problem ever to solve. Use a requirements.txt, use vagrant, and maybe even Salt or Chef if you require more specific tools.

Microservices are great in theory, but every app ends up requiring a lot more interconnectedness as you grow. I'm all for splitting services off, but it's usually something to consider once you're a few iterations in.

Re: Why we ditched Django for Microservices

#36
Judging by the following statements: "we don't worry much about code quality", and "lots of moving parts isn't without its complexity", I'm just going to very politely wish him luck in his endeavors, and maybe make some popcorn.

Re: Why we ditched Django for Microservices

#37
post #28

I don't get it: why does moving to microservices mean ditching Django? Couldn't you take your Django monolith and break it into separate (still-Django) microservices? I get that Django is seen as "too heavyweight" to do such a thing, though there are literally books ( http://shop.oreilly.com/product/0636920032502.do ) written about how to slim down Django. I get that monolith to microservice is all the rage these day…

Seconding this. Could someone clarify? I thought Django and "microservices" are orthogonal. Can't Django be used to create any service, even a micro service? I certainly used Django in the past just as a REST server, without any "web site" to speak of. It just reduces some boiler plate.

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 REST API's I've ever seen.

Re: Why we ditched Django for Microservices

#38
post #22
post #15

Earlier quoted context omitted.

I don't believe he's talking about code dependencies but rather things like LDAP, mySQL, MongoDB, etc which Java dependency management tools don't solve either. Managing code dependencies is solved in Python (as it is in most dynamic languages) using pip and virtual environments.

IME, encouraging people to only run part of the system results in a more fragile environment, and devs who can't fix problems in the wrong part of the system or change boundaries that were put in the wrong place. Everyone should be encouraged to be full-stack; specializing on one part or the other is ok, but you should be able to chase things into other components where necessary. From the talk of "packages" I think…

I wasn't trying to advocate only running part of the system.

Of course you can use things like puppet, but the comment I was replying to was saying these were solved problems in the Java world for more than a decade which isn't exactly true.

Re: Why we ditched Django for Microservices

#39
> For example: Messaging, Search, Authentication, etc. These all have different requirements and focuses and therefore lend themselves better to different languages.

What?

Every single one of those is a solved problem that has bindings to most major languages. Why in the world would you switch languages for an Auth mechanism (for example)?

Re: Why we ditched Django for Microservices

#40
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?

Post reply on HN