3 ms·
Thank you very much for your comment - I've realized that caching DNS should be considered in any "connected" service. I would add my two cents: - Calculate c
by piotrkubisa 10y ago
Thank you very much for your comment - I've realized that caching DNS should be considered in any "connected" service.
I would add my two cents:
- Calculate checksum and compare it with the latest entry (storing single 32/40-bytes long checksum takes lower amount of memory).
- Respect various HTTP headers like Expires, Cache-control, Accept-Encoding (accepting compressed content may relieve strain on bandwidth), Content-length, Cookie-length etc.
- If you were downloading a web-page and sending it via e-mail (for later usage?) you may gzip it - it may reduce costs of attachments or S3.
- Attach header "User-Agent" and "From" (with an e-mail address to contact developer) - if you don't mind.
- As you wrote, avoiding ioutil.ReadAll should be a good practice - Datadog published a blogpost which is worth reading - https://www.datadoghq.com/blog/crossing-streams-love-letter-gos-io-reader/ https://www.datadoghq.com/blog/crossing-streams-love-letter-...
- Use logrotate or implement it on your own with i.e. Mutex. Eventually you use fluentd, Kafka, Pub/Sub pipeline or some SaaS offer specialized in storing logs.
Most (or all) of Go packages with "request" in the name that I know doesn't cover aforementioned scenarios automatically - it is up to developer.