Microservices – Demo Project in Python
github.com
github.com
https://github.com/umermansoor/microservices/blob/master/ser...
N+1 HTTP requests. Ouch. Wouldn't it be nice to be able to do a database join?
movies_resp = requests.get("http://127.0.0.1:5001/movies?id=1&id=2&id=3")Also there's another downside to this approach: you lose the ability to do atomic transactions on the application's data.
By designing in this way, your scaling problems change from "the entire app fell over" to "the movie service fell over", which really helps with availability.
Not that there aren't disadvantages with microservices (overhead, distributed tracing, etc), I just think app architecture isn't one of them.
Once you load a few largish python libraries like sqlalchemy you can get up to 100mb per instance x 4 = 400mb.
What would be interesting is a framework that allows you to run the entire microservice stack in a single interpreter (shouldn't be hard with flask blueprints) and break off the subapps as necessary when the need arises.
You would need a way of managing the current endpoints for each service vs a requests.get('http://localhost:ARBITRARY_PORT') in the code, but if done correctly would make managing a cluster much simpler.
Does anyone know if such a thing exists?
The idea behind microservices is to have small services running on their own processes and communicating using a light-weight mechanism. This means you could write a service in Java, another in Python, Node.js etc. (i.e. pick the most appropriate language for the task)
They have different usages; I wouldn't say one is more secure than the other.
The only place auth is needed is for services that interact with users, and that works well in the microservice philosophy having an auth service which talks to all services as in user <-> service <-> auth
You can scale the auth system indirectly to the other services, and since auth is required almost everywhere means that you'll have a large part of your resources devoted to that.
Where it gets interesting is when you use external microservices for auth like stormpath - is it a good idea to talk to that directly, or use a mediation auth service of your own - I usually prefer the 2nd method since while there is an extra hop - it makes the api more static and allows you to swap out what your app uses for auth much more easily.
Given what we now know post Snowden, it's certainly advisable to encrypt internal transports whenever possible.
As an additional example, lots of people tend to mistake MPLS as being encrypted as opposed to just being a private network so it's definitely advisable to make sure traffic is encrypted whenever possible inside or out.
I personally prefer to maintain a "need to know" approach to communication between all systems on my network (including services, databases, infrastructure).
This means that, for example, if my public-facing vehicle lookup service is compromised, my users' data is still a long way away. This is enforced by: (1) not providing an address to the service, (2) not providing the keys/passwords required to authenticate with the service.
Not doing authorization internally means that the moment a single process running on your network is compromised (which almost certainly is possible), your attacker now has access to the entirety of your system, and you're fucked.
Also, the overheads can be extremely low - to the point that they're not noticeable. It just depends how you do it.
The positioning machine in action...
Python 2.7 ```
oh sad day :(