Java Blogs


API Rate Limiting with Spring Cloud Gateway

Haytham Mohamed April 22, 2021

One of the imperative architectural concerns for software architects is to protect APIs and service endpoints from harmful events such as denial-of-service attacks, cascading failures, or overuse of resources. Rate limiting is a technique used to control the rate by which an API or a service is consumed, which in turn can protect you from these events that can bring your services to a screeching halt. In a distributed system, no better option exists than to centralize configuring and managing the rate at which consumers can interact with APIs. Only those requests within a defined rate would make it to the API. Any more would return an HTTP 429 (“Too Many Requests”) error.

An example how a gateway between the consumer and an API can help limit the number of requests the API is serving

Spring Cloud Gateway is a simple and lightweight component that can be used to limit API consumption rates. In this post, I am going to demonstrate how easily that can be accomplished using a configuration method. As shown in the figure below, the demonstration consists of both a front- and backend service, with a Spring Cloud Gateway service in between.

The gateway can sit between the frontend and the backend to help manage the traffic between the two

No code whatsoever is needed to include the Spring Cloud Gateway in the architecture. You need instead to include the Spring Boot Cloud dependency org.springframework.cloud:spring-cloud-starter-gateway in a vanilla Spring Boot application, then you’ll be set to go with the appropriate configuration settings.

Requests received by Spring Cloud Gateway from a …

Read more

Introducing the Tanzu Observability Slug Generator

Dan Florea April 15, 2021

A great feature of Tanzu Observability is that all context about the chart or dashboard that you are looking at is encoded in the URL, which makes it easy for you to share those links with your colleagues and to deep link into our product from other places such as wiki pages. A consequence of this is that the URL slug is rather involved. This is not a problem when the UI generates the URL, but it becomes very tedious when customers try to create the URL on their own in order to automate and embed Tanzu Observability charts and dashboards outside of the product itself.

To help customers take better advantage of Tanzu Observability charts and dashboards as well as allow easier automation and customization, we recently open sourced our Tanzu Observability URL slug generation code. This code lets you programmatically generate links to charts and dashboards that you can then embed wherever you like to give users an easy to find view of the metrics that matter to them.

What is a URL Slug?

If you are not familiar with a URL slug, it is the last part of a URL that comes after the domain name. For example:

https://www.vmware.com/company.html

In the URL above, “company.html” is referred to as the URL slug.

In some cases, the URL slug is relatively simple. In the case of a Tanzu Observability chart or dashboard, a lot of information is encoded in the slug which makes it difficult for …

Read more

Highlights of the SpringOne 2020 Self-Paced Workshops - and Their New Home

Ivan Tarin September 17, 2020

SpringOne 2020 just wrapped, and the self-paced workshops were a complete success! Moreover, all of your requests to continue providing these workshops beyond the conference have been heard. Their future home will be the Tanzu Developer Center. UPDATE: These workshops are available to try out now!

SpringOne 2020 Workshops and Training

For those that missed SpringOne 2020, we’ll quickly recap what the workshops focused on and what they accomplished. Feel free to jump around if you need to; the recap is meant to be a quick read with plenty of pictures.

A total of 10 self-paced workshops covering a range of open source technology—from CI/CD with Tekton, several Spring technologies, and infrastructure technology like Kubernetes, Octant, and Carvel—were available at SpringOne 2020:

  • Kubernetes Fundamentals
  • Container Basics
  • Getting Started with Octant
  • Getting Started with Spring Boot on Kubernetes
  • Spring Boot Probes on Kubernetes
  • Spring Boot Skaffold on Kubernetes
  • Spring Microservices
  • Getting Started with Spring Cloud Gateway
  • Getting Started with Carvel (formerly k14s)
  • Tekton Fundamentals

Each of these workshops has an environment prepared and ready, which is quite refreshing when you are accustomed to spending 15-30 minutes setting up to follow a tutorial. The workshop environment is also native to the technology being used. For example, you can interact with actual Kubernetes clusters in a Kubernetes workshop or work …

Read more