1/22/2024 0 Comments Grpc message queue![]() ![]() ![]() gRPC is more efficient and suitable for complex microservices and real-time applications, while REST is more widely adopted and simpler to use for basic APIs. gRPC is a high-performance, binary, and strongly-typed protocol using HTTP/2, while REST is a simpler, text-based, and stateless protocol using HTTP with JSON/XML. Here are the results on a 1GB ram / 0.If you’re at all familiar with APIs, you know that REST APIs are the main API used, particularly when it comes to microservices and their applications. The results we cared about were number of requests/second, the number that failed, and the request duration. That is, we hosted our event API on ECS, then pushed events onto SQS and consumed them via another ECS service. We set up our basic self-hosting stack using AWS’ managed services. You can also use K6’s cloud to handle running the tests, though your services should still be set up on real-world, prod-like infra to understand its limitations. an EC2 machine which connects to your services via the public internet. In order to really understand how many requests you can receive, you need to set up your services on new infrastructure and test it from an external machine - eg. This isn’t going to give you a good sense of real-world usage, even if it does help with CPU and memory profiling. ![]() The above shows a test from your own machine to… your own machine, no internet required. Setting up the infra for real-world tests I’d highly recommend a quick browse through to understand all of the options available. Honestly, the K6 documentation is some of the best documentation online we’ve seen. post.js 13.30s user 6.14s system 63 % cpu 30.576 totalīy default, this shows you the p90 and p95 latencies for the requests sent - though this is easy to customize, including streaming output (as events) to different services. Here’s an example test which submits a small JSON payload to an API: It allows you to define small JS-based tests, ramp up load, then export the results in many different formats for visualization, CI/CD, etc. K6 is a Go-based load testing tool which makes performance testing, well, easy. We’ll dive in to a basic load test using K6, showing how we used it to test our events API for our event-driven queue. The easiest modern benchmarking tool to set up and use (in our opinion) is k6.io. , a modern load testing tool written in Go, capable of generating load with complex requests defined in JS-based scripts, with many metric options.This can generate significant load, and comes with Lua scripting. , one of the early event-loop based systems from 2013.Nowadays, most people are using HTTP2/QuiC and, accordingly, there are more modern tools available to benchmark. Long gone are the days where people reach for Apache and good ol’ GCI-BIN. One of the classics is ab - ApacheBench, designed to test Apache servers. To do that, you’ll be reaching for a load testing or benchmarking tool. HTTP or gRPC APIs) it’s good to know your metrics and limits. Load testing an event-driven queueĮvery time you’re building interconnected systems (eg. And we need to know how many events we can handle from a single event API. So… In order to be highly available, we need to make sure the HTTP endpoint that accepts events is as fast as possible. You might say the core use case of queues and event driven systems is to increase availability and scale. It differs from typical queues (like SQS, Celery) because it accepts JSON events via HTTP to triggers functions, and it lets you do novel things like data governance with event schemas, proper function versioning, historical event replay, user attribution, or blue green deploys - stuff we’ve come to expect from modern tooling. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |