9 ms·
Sample cloud-native application with microservices
- gravypod 8y agoIt's unfortunate that each project has a `genproto.sh` and that there's no tool that autogenerates protocol libraries/modules for any consuming language. It's a real pain point of trying to get people to look at gRPC. I'd be amazing if there was a simple way to have: .proto(s) -> language code -> language binary/package Completely automated and ready for an import into a project.
- EdSchouten 8y agoBazel should be pretty good for that: https://bazel.build/ https://bazel.build/ https://docs.bazel.build/versions/master/be/protocol-buffer.html#proto_library https://docs.bazel.build/versions/master/be/protocol-buffer.... We use it at work to build a web app whose backend is written in Go and frontend in Typescript. All of the code gets built and placed in a Docker image using these rules: https://github.com/bazelbuild/rules_docker https://github.com/bazelbuild/rules_docker
- alpb 8y agoHi author here. We wanted to keep the demo app as simple as possible for readers. Adding Bazel would introduce another layer of complexity whereas most devs can read bash scripts that are a couple of lines.
- gravypod 8y agoWhat sucks is this is all generated at compile time. I loose out on auto completr from my IDE if codegen is done during build.
- reustle 8y agoCould someone please point me in the direction of some solid documentation about deciding on when / how to split out microservices? So many of the cases I see them used are overkill and just make development and devops far more complicated for the scale of the application & amount of data/users being processed. I find myself usually comfortable with splitting out Auth (Cognito?), Payments (Stripe?), and not much else.
- dlor 8y agoMy favorite way to think about this is to apply a reverse Conway's law. Architect your microservices like your org chart. One of the main benefits of decoupling a monolithic application is getting the freedom to release, scale and manage different components separately. Each team becomes empowered to define their own practices, procedures and policies that are appropriate to their business requirements. Have a mission-critical component that needs 5 9s reliability (auth or billing)? Great, release that carefully over multiple days with canarying across failure zones. Working on an experimental API for a new mobile app? Awesome, ship every commit.
- lilcorey10 8y agoArchitecting microservices like your org chart would be Conway's Law, correct?
- dllthomas 8y agoYeah, I don't think it's "reverse" either. The common quote "if you have four groups working on a compiler, you’ll get a four-pass compiler" clearly has architecture following from organizational structure.
- majewsky 8y agoIt's reverse because Conway's Law, as stated, says that code structure inadvertently arises from org structure, i.e. code = f(org). The reversal is to architect the org structure to ensure optimal code structure, i.e. org = f(code).
- dllthomas 8y agoThat is reverse, yes. I think your original comment was unclear, if not misstated. I had read the "like" in "[a]rchitect your microservices like your org chart" as something like "to resemble", and the rest of the comment seems to follow just fine. Other readings seem possible but I don't see one that gives the sense you want without what feels like some serious contortion. In any case, no worries, we're clearly on the same page now - just trying to figure out what went wrong.
- chvid 8y agoIs this satire?
- jhwang5 8y agoCertainly it was an attempt to be hip, not sure if it worked.
- chvid 8y agoYes. I know hn don’t like one line questions like that which may be read as an insult. But I honestly cannot tell. It is obviously a lot of work. But the technology mix and design is just absurd. The choice of web shop with hipster products is tongue in the cheek but so was the pet store of year 2000.
- jbarham 8y agoI honestly thought it was myself until I saw that it was an official GCP repo. Unbelievable... Sending emails is a one-liner in Django. Am I a sucker for not building my own email sending service?! Of course being a Google demo they have to include the obligatory ad server service, in Java no less. Nonsense like this is why I'm steering my kids away from considering software development as a career.
- kumaraman 8y agoWhen a company and platform grows it's very common to build out an email sending service since you can only send so many emails per second. An example of an email sending service is Sendgrid, who have built an entire company around this service.
- jbarham 8y agoI'm aware, I've used Postmark for years. My point is that building your own microservice to send emails is ridiculous overkill.
- deleted 8y ago
- lazyant 8y agoWhy both a ClusterIP and a LoadBalancer services to expose frontend 8080 as 80? Also, no persistent data storage (no data to the store owner)? (I guess for easier example)
- kumaraman 8y agoThe ClusterIP and LoadBalancer are on separate network interfaces. The ClusterIP exposes the service on an internal interface whereas, the LoadBalancer exposes on a public interface. https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types https://kubernetes.io/docs/concepts/services-networking/serv...
- jjeaff 8y agoClusterIP would be to access the frontend from within the cluster. LoadBalancer would of course be for external access.
- alpb 8y agoHi, the author here! The clusterip one is used by Istio (if you’re following the Istio instructions) but it’s harmless to have an internal LB. The other one is exposing an external LB, which is useful both if you’re using GKE (or any cloud provider) or GKE+Istio. We deliberately wanted to leave state out as it complicates things by quite a bit, but doesn’t add much value in terms of the technologies we wanted to showcase.
- eweise 8y agoThey should change the name "Go" to "if err != nil"
- why-el 8y agoI don't understand why people don't like that. If you hate it so much, why not write a plugin for your text editor that collapses it? This will make read the Go code much faster, and only peek in if you are curious. The proposed `check` keyword will not remove the cognitive load this generates either. The way I see it, I'd rather have it. Took maybe 30 seconds to write, eliminated a whole class of bugs, and if I don't like it, I will write that plugin to hide it.
- cakoose 8y agoWhat do you mean by "eliminated a whole class of bugs"?
- gtaylor 8y agoIt's really easy to let exceptions raise and pass through in languages like Python. In Go you'll typically return and handle errors explicitly. This makes it easier to reason about potential failure modes and behaviors in some cases. But it is very verbose error handling.
- fierro 8y agoI think he meant that it changed the nature of error handling, and thus changed the way developers think about bugs and the way we encounter them. Errors are returned from function calls, and callers are expected to check the value of that error. The error must be assigned into a variable (or intentionally ignored, which should never pass a code review), and then must be checked. This forces errors to be handled on the spot, or returned up the call stack intentionally, usually with some extra info/annotation. You don't get try/catch scenarios where an error is caught 10 calls above where it occurred. Imagine writing Java, and wrapping every function call in a try/catch block, and inspecting the exception if one was caught, and then handling it or re-throwing it. That's kind of what we do in Go. There are no "unexpected errors" because it is clear where all errors originate and how they are to be handled. Go2 will improve on this if err != nil syntax, possibly with some function-scoped error handler and a new language level handle/check concept. Check it out https://dev.to/deanveloper/go-2-draft-error-handling-3loo https://dev.to/deanveloper/go-2-draft-error-handling-3loo https://github.com/golang/go/wiki/Go2ErrorHandlingFeedback https://github.com/golang/go/wiki/Go2ErrorHandlingFeedback
- ejholmes 8y agoI know this was probably well intentioned, but I can't shake the irony of how overly complex and over-engineered this is. If you're just starting out, please, please, please don't do this.
- kumaraman 8y agoDepends on the scale of this online store, if it saw 0.1% the amount of traffic as Amazon then it is justified.
- bpicolo 8y agoMicroservices solve a number of engineers scale problem, not a traffic scale problem. Tech scale is drastically more simple in a single application, because you don’t introduce an unreliable network and related complexity into all of your problems
- kumaraman 8y agoInteresting, in my experience we've never had major issues with our service mesh or internal networking. It definitely introduces a lot more complexities. I suppose we've always had a dedicated devops team so I'm probably unaware of a lot of these issues. I'd be interested in some resources around this topic if you know of any.
- bpicolo 8y agoI'll be honest - pretty hard to find objective literature on it, because most of the literature is just trying to tell you microservices will solve all of your problems. I think ultimately the best link between the two is Amazon's move to microservices and their focus on "2 pizza teams". https://www.slideshare.net/TriNimbus/chris-munns-devops-amazon-microservices-2-pizza-teams-50-million-deploys-a-year https://www.slideshare.net/TriNimbus/chris-munns-devops-amaz...
- xnxn 8y agoMan, this is a frustrating and shallow criticism. Obviously this is over-engineered. It's a demonstration of how these patterns would fit together in an application that required them.
- revskill 8y agoJava ? Hell no. Java is the worst language + build system i've seen. It killed my brain than anything else. You need to remove two things: Docker and Java from this stack before it's really cloud-native.
- marcrosoft 8y agoHow the heck did we get here as an industry. The complexity is ridiculous.
- cobookman 8y agoReminds me of the JavaScript craze of 2010-2015. With a new framework each week on HN. Give it time it'll mature and people will be burnt out from all the changes
- hinkley 8y agoIt’ll be something else then. We can’t tell motion from progress so we just keep moving and moving.
- drdaeman 8y agoNot just complexity, but quantity of tools that do the same thing. Helm, Forge, Ksonnet, Operators, now this Skaffold (haven't heard of it before)... Sure, there are some differences, but still... I'm currently moving one app from GAE to GKE and saw recipes for using all of those to describe the infrastructure. Quantity itself is not an issue - it's great to have options. Incompatibility, segmentation and uncertainity about the future are issues, though. E.g. ksonnet and Forge are dying. Some say Helm isn't particularly healthy, too - is it just speculations or would it die in next year or two, leaving all those charts repos a dead code for archeologists? Maybe that's just me, but modern DevOps feels like JavaScript world from a few years ago. Things are born in abundance, promise lots, and die before they're even v1.0.
- _bxg1 8y agohttps://xkcd.com/927/ https://xkcd.com/927/
- gtaylor 8y agoI have the opposite impression of Helm. I'm seeing vendors and other companies cranking out and sharing Charts at a rate I've never seen before. There are some review issues in the main upstream Helm Chart repo, but that's due to volume (which is now higher than ever).
- Omnipresent 8y agoTried grpc's in a production application where one microservice had to make over a million grpc connections to another microservice. We experienced ton of memory leaks and switched over to http/json which has been working well. Implementation was done in Scalla, Akka. Curious to know if others have had similar experiences or if there is another best practice with grpc's that we're missing.
- shereadsthenews 8y agoObviously a million open sockets uses more memory than having a stateless http backend. However, having worked on the very largest RPC service deployment ever fielded I feel it is safe to say that there is no reason to have a million open gRPC channels.
- achiang 8y agoThe problem that gRPC solves for you is versioning your messages between your services. As your json payloads evolve, you're going to encounter pain trying to keep your services in sync, whether it comes in the form of writing parsing code to crack open payloads and do conditional error checking based on the version (and expected fields), or whether it comes operationally in how you actually deploy updates to running services.
- zepolen 8y agoThat's solved by protobuf, not grpc.
- brown9-2 8y ago...why did one service need to make a million connections to another service?
- warp_factor 8y agoCompletely ridiculous. I have been in the Kubernetes community for a couple years now, and there is a crazy amount of ridiculous unneeded micro-optimization for problems that nobody except the 1% of users got. Istio mesh is a good example.
- tech_tuna 8y agoSo is Kubernetes.
- deleted 8y ago[deleted]
- je42 8y agodepends on the number of teams/services/languages you got. istio solves a lot of problems in that spaces when teams/services/languages grow larger. so, i would think the percentage is larger than 1%.
- deleted 8y ago[deleted]
- cle 8y agoWhy is everyone freaking out? This is a demo of the technology, its complexity is contrived to demonstrate various facets. This kind of architecture is not unreasonable for larger companies with many teams, which is where the technology itself becomes useful as well. So in that context, this architecture is entirely reasonable.
- tedunangst 8y agoThere's a fine line between "this is possible" and "this is how it should be".
- _pmf_ 8y agoThe line is fine, but this is already miles behind it.
- benatkin 8y agoI really despise the phrase "cloud-native", but this is a cool project, because it shows how you can have a bunch of different platforms (python, go, node, etc) running together, and how you can set them up locally without having to worry about how to install them. Also there's no worry about someone publishing a package to npm that overwrites your documents, because everything runs in containers. I'd love to say this is overcomplicated and to just use Docker Compose, but I don't think Docker Compose is the way to go. The next thing I'd like to see is how to get this integrated with vscode or Atom to provide autocomplete without installing everything locally.
- tech_tuna 8y agoHow about "cloud-amenable"?
- emersonrsantos 8y ago"Any intelligent fool can make things bigger and more complex... It takes a touch of genius - and a lot of courage to move in the opposite direction" - Einstein
- jasonvorhe 8y agoEveryone can randomly quite Einstein.
- ISO-morphism 8y agoMicrosoft has a similar reference application [1]. There are comments arguing these architectures create a ridiculous amount of overhead for what would be a simple application traditionally, and others countering that the point is to show the underlying tech in the context of a "simple" problem. I think there's a large amount of truth for both sides. It feels like there's a great paradigm shift on the horizon, and hopefully a good set of abstractions to build with. We're programming in machine-specific assembly languages, waiting for a high-level language to come along so we don't worry about things like calling conventions anymore. [1] https://github.com/dotnet-architecture/eShopOnContainers https://github.com/dotnet-architecture/eShopOnContainers
- Yhippa 8y agoI don't have peers where I can bounce off my thoughts and get answers to solutions like these. I've been very curious about serverless microservices architectures and this repo has given me a pretty clear way of doing it while showcasing polyglot microservices and persistence. I get that it looks like it has a lot of overhead for what it tries to do but I can grok scaling this up for an enterprise application.
- thunderbong 8y agoIf this was just for demonstration, they could have done it with just a couple of microservices. Why get the full web stack in the picture?
- alpb 8y agoHi, author of the demo here. We went with a complex app to show a realistic complex scenario. This way we get non-trivial trace graphs and metrics from monitoring tools.
- esseti 8y agoon thing that still i don't get with microservices is where to put the central control. Usually, services requires: authentication, authorization, execute, (errors), response. Now, there should be a reverse-proxy that first call the authentication, if correct, calls authorization, if correct call the execution. But, how do people do that?
- dilyevsky 8y agoIstio (part of that demo) or Spire (SPIFFE) do that for you.
- iamgopal 8y agoCalm Down, Its showcase of what is possible, not what is ideal solution.
- nzoschke 8y agoI really appreciate projects like this. It’s helpful for casual observers to understand all the pieces of the stack. You can get an immediate feel if the approach is right for you and your team. And it’s helpful for engineers to have examples to reference copy when implementing the patterns themselves. I’ve been working on project similar to this for go, gRPC and Envoy: https://github.com/nzoschke/gomesh https://github.com/nzoschke/gomesh My project doesn’t go into deployment or K8. If I needed to figure that out I’d look at the OP project. I also have a project that demonstrates Go and Lambda: https://github.com/nzoschke/gofaas https://github.com/nzoschke/gofaas If these help even a few engineers learn to be successful with the tools it’s a win.
- oldsj 8y agoLet me try to break this down from first principles, since I'm not sure I agree with the largely negative sentiment ITT around how complex this looks: Most software projects are long lasting, and have unpredictable and constantly changing requirements. Agile is currently the best software development methodology under these constraints. Effective Agile teams should not be larger than 10 people total, minus the PO and Scrum Master leaves 8 devs. Its not possible to run a large scale, high traffic web application with only 8 devs. Therefore, it makes sense to split large applications up into chunks small enough for a 10 person team to manage autonomously. Since the application had to be split up, we now have to solve the communication issue. Now we need networking, DNS, TLS, have to consider latency and bandwidth, etc... We also have other issues if we’re running at scale: redundancy, monitoring, separate environments for testing and production, having a local dev environment similar to the production environment. There is a huge list of things that are not important to for an early stage startup to think about, but are very important and very difficult for most large enterprises to get right if they want to consistently and reliably deliver good software. Google is a large enterprise that operates large scale web services that has proven they know how to get this stuff right. This repo is a reference architecture, from Google, on how to run micro services at scale using modern tools and methodologies. If you think this is over engineered I think you're just not the target audience, and something like Heroku is much better suited for your scale.