Chapter 4 Serve Requests with gRPC

Distributed Services with Go — by Travis Jeffery (29 / 84)

The Pragmatic Programmers
The Pragmatic Programmers

--

👈 Part 2 Network | TOC | What Is gRPC? 👉

We’ve set up our project and protocol buffers and written our log library. Currently, our library can only be used on a single computer by a single person at a time. Plus that person has to learn our library’s API, run our code, and store the log on their disk — none of which most people will do, which limits our user base. We can solve these problems and appeal to a larger audience by turning our library into a web service. Compared to a program that runs on a single computer, networked services provide three major advantages:

  • You can run them across multiple computers for availability and scalability.
  • They allow multiple people to interact with the same data.
  • They provide accessible interfaces that are easy for people to use.

Some situations where you’ll want to write services to reap these advantages include providing a public API for your front end to hit, building internal infrastructure tools, and making a service to build your own business on (people rarely pay to use libraries).

In this chapter, we’ll build on our library and make a service that allows multiple people to interact with the same data and runs across multiple computers. We won’t add support for clusters right now; we’ll do that in Chapter 8, Coordinate Your Services with Consensus. The…

--

--

The Pragmatic Programmers
The Pragmatic Programmers

We create timely, practical books and learning resources on classic and cutting-edge topics to help you practice your craft and accelerate your career.