{"id":16261197,"url":"https://github.com/fuxingloh/spring-cloud-gateway-exploration","last_synced_at":"2026-04-02T18:53:46.616Z","repository":{"id":55115042,"uuid":"325709453","full_name":"fuxingloh/spring-cloud-gateway-exploration","owner":"fuxingloh","description":"A curious exploration into blocking, nio and reactive implementations of Spring Cloud Gateway with a caching downstream service and back pressure of running such system.","archived":false,"fork":false,"pushed_at":"2021-01-09T05:12:21.000Z","size":344,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-02T00:49:51.219Z","etag":null,"topics":["blocking","java","netty","nio","reactive","redis","spring","spring-boot","spring-cloud-gateway"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fuxingloh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-12-31T04:00:13.000Z","updated_at":"2021-01-09T05:12:23.000Z","dependencies_parsed_at":"2022-08-14T12:30:34.792Z","dependency_job_id":null,"html_url":"https://github.com/fuxingloh/spring-cloud-gateway-exploration","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fuxingloh%2Fspring-cloud-gateway-exploration","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fuxingloh%2Fspring-cloud-gateway-exploration/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fuxingloh%2Fspring-cloud-gateway-exploration/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fuxingloh%2Fspring-cloud-gateway-exploration/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fuxingloh","download_url":"https://codeload.github.com/fuxingloh/spring-cloud-gateway-exploration/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247856542,"owners_count":21007621,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blocking","java","netty","nio","reactive","redis","spring","spring-boot","spring-cloud-gateway"],"created_at":"2024-10-10T16:40:45.075Z","updated_at":"2025-12-30T23:06:26.862Z","avatar_url":"https://github.com/fuxingloh.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Spring Cloud Gateway Exploration\n\n[![Load Testing](https://github.com/fuxingloh/spring-cloud-gateway-exploration/workflows/Load%20Testing/badge.svg)](https://github.com/fuxingloh/spring-cloud-gateway-exploration/actions?query=workflow%3A%22Load+Testing%22)\n\n\u003e An exploration into blocking, nio and reactive implementations of Spring Cloud Gateway with a caching downstream\n\u003e service and system back pressure of running such system.\n\nInitially, I wanted to explore zero-copy multicast with multi-subscriber bytebuffer gateway caching. Redis was chosen due\nto the familiarity and popularity of the cache engine. However, during the exploration, the current state of Java\nreactive client for Redis is confusing for me due to unfamiliarity.\n\nIt requires much more exploration into their internal implementation to understand how the client are implemented and\nwhether it support the reactive streams. After further browsing of the clients, both lettuce and reddison exposed Mono\ninstead of Flux.\n\nMy hypothesis was to implement a gateway cache that reactively stream the byte buffer directly up and down without\nretaining any at memory. This greatly reduces the backpressure on the system as there will be no wait and everything is\npassed along reactively. There was motivation to create such a client for this demo, but the complexity was a deal\nbreaker for me.\n\nAt the end of the day, reactivity is hard, you don't choose reactivity for just performance.\nThere are also much beauty of how things are done in the Spring Framework, Reactor and WebFlux.\n\nFYI, all 4 gateway implementation sucks, don't take them as reference.\n\n## Gateways \u0026 Service\n\nAt the end, I used the 3 most popular redis client and ran the test [locally](.github/workflows/load.yml). You can\nexplore the sub modules for more information of the implementation.\n\n* [Service](./service) for the gateway downstream.\n* [Gateway Forward](./gateway-forward) forward request to downstream without caching.\n* [Gateway Jedis](gateway-jedis) cache with jedis client.\n* [Gateway Reddison](./gateway-reddison) cache with reddison reactive client.\n* [Gateway Lettuce](./gateway-lettuce) cache with lettuce reactive client.\n\n## Goals\n\n- [x] Service: Flexible downstream service for testing\n- [x] Gateway Forward without caching for control testing\n- [x] Gateway Jedis\n- [x] Gateway Reddison\n- [x] Gateway Lettuce\n- [ ] Run test on AWS?\n- [ ] Write an article if there is interest or potential for a topic.\n\n## How to run?\n\n```bash\n# Build docker images\n$ ./gradlew bootBuildImage\n\n# Run gateway-forward (forward/jedis/reddison/lettuce) \n$ docker-compose up gateway-forward\n\n# Run stress test on 'forward' with 1k vcu\n$ docker run --network host -i -v \"$PWD:/benchmark\" loadimpact/k6 run -e TYPE=forward /benchmark/test.js \n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffuxingloh%2Fspring-cloud-gateway-exploration","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffuxingloh%2Fspring-cloud-gateway-exploration","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffuxingloh%2Fspring-cloud-gateway-exploration/lists"}