productcatalogservice

command
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 14, 2019 License: Apache-2.0 Imports: 25 Imported by: 0

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 on every call to to the server.

For example, use EXTRA_LATENCY="5.5s" to sleep for 5.5 seconds on every request.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL