Microservices Redundancy Elimination Notes
This post is a summary of my notes from working on the “Redundancy Elimination in Microservice Communication” research project.
Tutorials for Dev Tools
I had to learn to use all the tools from scratch, including Docker, Kubernetes, and Istio. Contrary to projects in my previous posts, I am developing on Windows 11 for this project. Here are some tutorials that I found helpful and up-to-date, in order:
- Running Istio with Kubernetes on Docker Desktop (Docker Labs)
- Getting Started with Kubernetes on Docker Desktop (Docker Labs)
- Setting up Istio with Docker-Desktop on Windows 10 (Medium post)
- Getting Started (official Istio guide)
Regarding the official Istio guide, if we wanted, we can do step 3 of “Deploy the sample application” in Bash (e.g., Git Bash). We’ll be able to confirm the whole setup is working interactively later, either way.
The Medium guide says to forward port 80 to 8080 for some reason, but accessing BookInfo like this worked fine for me:
http://localhost/productpage
(now we can access it from other devices in the same local network, after looking up host address with ipconfig
)
References and Documentations
Here are some links to references/documentation that were very helpful for development:
- Using Lua filter to modify HTTP response body in Istio (StackOverflow question)
- Lua Filter (Envoy doc), which is one kind of
HTTP_FILTER
native to the Envoy proxy; in turn, Envoy proxy is the backbone of Istio. - Envoy Lua script examples (Envoy doc)
- Lua (proto) (Envoy doc)
- EnvoyFilter Docs (Istio doc)
- EnvoyFilter Samples (Istio GitHub doc)
Observations
Docker RAM usage
Docker was eating up my RAM. I don’t know why vmmemWSL
still says it’s using around 4 GB of memory after I kill Docker Desktop. I ended up doing wsl --shutdown
after I’m done developing for the day. There have been similar reports: WSL2 + Docker causes severe memory leaks in vmmem process, consuming all my machine’s physical memory.
importing Lua libraries
IBM Cloud has a tutorial for writing Lua filters in Istio, which involves loading external Lua libraries. As it turns out, importing external Lua library is NOT trivial; it requires updating the Docker image. References here and here.
Lua filters are stateless
Lua filters are stateless and can’t be used for e.g., caching. (I ended up just using it for per-request compression)
- “Lua state is per worker”
- “Shared state in lua would negate a potential requirement to utilize c++ simply to achieve shared state.”
- alternatively, build it in Rust/Go/… and compile to Wasm. References here and here.
questions about Envoy Filter
Here are some questions that I had trouble finding answers to, regarding configuring the Envoy Filter through .yaml
files:
- What is the difference between
envoy.filters.http.lua
andenvoy.lua
forpatch.value.name
? inlineCode
vsinlineString
?