Huxley 2, my cross-platform .NET JSON proxy for the GB railway Live Departure Boards SOAP API, has some new updates. You can try it out now on the demo server.
I’ve upgraded it from .NET Core 3.1 LTS to .NET 6.0 LTS (supported until 2024-11-08) including for the Docker container and Azure pipelines support. I’ve moved from C# 8 to C# 10 (as some C# 9 pattern matching features are now used) but I was already already using nullable reference types.
I’ve also added in a couple of performance improvements. I’ve added ETag support (excluding generated at times so the hash doesn’t change unless the train services etc. change) and Brotli compression (enabled for HTTPS too).
These two performance improvements are to reduce the environmental impact of transmitting service information to clients. Electricity is required to send every bit and wireless transmission uses more energy than wires. By locating the proxy closer to the data source, downstream bandwidth can be reduced. Aside, environment concerns are another good reason to block ads.1
The compression middleware can reduce the size of a response to 6-15% of its original uncompressed size in my tests. Additionally, if a client (e.g. a web browser) sends an ETag that matches what the server has calculated for the response then only an HTTP code 304 (Not Modified) is sent (with no response body) and the local cache is used.
The ETag is calculated from a hash of the service data but excluding the timestamp that always changes. This means that the ETag only changes if there is an update to the board or service information.
- Environmental impact assessment of online advertising: “Online advertising consumed between 20.38 to 282.75 TWh of energy and 11.53 – 159.93 million tons of CO2e was emitted to produce the electricity consumed.” (part of Towards Sustainable Data Centers and ICT Services [PDF]). ↩