Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/avinashupadhya99/productcatalogservice
https://github.com/avinashupadhya99/productcatalogservice
Last synced: 16 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/avinashupadhya99/productcatalogservice
- Owner: avinashupadhya99
- Created: 2022-10-05T16:43:41.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-10-07T15:01:54.000Z (over 2 years ago)
- Last Synced: 2025-01-10T08:47:44.684Z (22 days ago)
- Language: Go
- Size: 54.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# productcatalogservice
Run the following command to restore dependencies to `vendor/` directory:
dep ensure --vendor-only
## Dynamic catalog reloading / artificial delay
This service has a "dynamic catalog reloading" feature that is purposefully
not well implemented. The goal of this feature is to allow you to modify the
`products.json` file and have the changes be picked up without having to
restart the service.However, this feature is bugged: the catalog is actually reloaded on each
request, introducing a noticeable delay in the frontend. This delay will also
show up in profiling tools: the `parseCatalog` function will take more than 80%
of the CPU time.You can trigger this feature (and the delay) by sending a `USR1` signal and
remove it (if needed) by sending a `USR2` signal:```
# Trigger bug
kubectl exec \
$(kubectl get pods -l app=productcatalogservice -o jsonpath='{.items[0].metadata.name}') \
-c server -- kill -USR1 1
# Remove bug
kubectl exec \
$(kubectl get pods -l app=productcatalogservice -o jsonpath='{.items[0].metadata.name}') \
-c server -- kill -USR2 1
```## Latency injection
This service has an `EXTRA_LATENCY` environment variable. This will inject a sleep for the specified [time.Duration](https://golang.org/pkg/time/#ParseDuration) on every call to
to the server.For example, use `EXTRA_LATENCY="5.5s"` to sleep for 5.5 seconds on every request.