Reading list July 2023

The list of things I read or watched this month The right way to define a C function with no arguments - https://www.youtube.com/watch?v=VsRs0H4hXEE TREE-STRUCTURED CONCURRENCY — 2023-07-01 - https://blog.yoshuawuyts.com/tree-structured-concurrency/ Myths Programmers Believe about CPU Caches - https://software.rajivprab.com/2018/04/29/myths-programmers-believe-about-cpu-caches/ Eventual vs Strong Consistency in Distributed Databases - https://hackernoon.com/eventual-vs-strong-consistency-in-distributed-databases-282fdad37cf7 Accounting For Developers, Part I - https://www.moderntreasury.com/journal/accounting-for-developers-part-i Accounting For Developers, Part II - https://www.moderntreasury.com/journal/accounting-for-developers-part-ii Accounting for Developers Part III: Building a Lending Marketplace - https://www....

July 31, 2023 · 7 min · poorlydefinedbehaviour

Sending logs and traces to Grafana cloud from your Rust application

Sending logs and traces from a Rust app to Grafana cloud Run the Grafana agent Put the Grafana agent config in grafana-agent/agent/agent.yaml. server: log_level: debug logs: configs: - name: default positions: filename: /tmp/positions.yaml scrape_configs: - job_name: varlogs static_configs: - targets: [localhost] labels: job: varlogs app: rust-grafana-metrics-logs-traces __path__: /var/log/app/*log clients: - url: <grafana-cloud-loki-url> traces: configs: - name: default receivers: otlp: protocols: grpc: remote_write: - endpoint: tempo-us-central1.grafana.net:443 insecure: false # only add this if TLS is not required basic_auth: username: <grafana-cloud-tempo-username> password: <grafana-cloud-tempo-password> batch: timeout: 5s send_batch_size: 100 Run the Grafana agent docker run \ -v $PWD/grafana-agent/data:/etc/agent/data \ -v $PWD/grafana-agent/agent....

July 22, 2023 · 3 min · poorlydefinedbehaviour

Thinking about failure, fair-loss links and two generals

It feels like most people are not used to thinking about how things can fail, programming as if things always work as expected is the default modus operandi of most engineers i have talked to. Some examples that come to mind: http requests without handling responses that don’t have status 200, no timeouts, no retries, publishing a message to kafka and them updating a database, having a web client orchestrate a transaction across several systems without thinking: what if the user closes the browser tab?...

March 28, 2023 · 3 min · poorlydefinedbehaviour

The simple way to avoid deadlocks

A deadlock happens when there’s at least one resource that can be only acquired by one process at a time and there’s a process P1 that is waiting to acquire a resource currently held by a process P2 and P2 is waiting to acquire a resource currently held by P1. The word process does not mean we are talking about just OS processes. There are two processes: Process A wants to acquire a lock on resource 1 and then a lock on resource 2....

March 25, 2023 · 2 min · poorlydefinedbehaviour

Database anomalies and isolation levels

Anomalies An anomaly or read phenomena can happen when a transaction reads data that may have been modified by another concurrent transaction. Dirty read A dirty read happens when a transaction T1 reads data that has been modified by a concurrent transaction T2 that has not has been committed or rolled back yet. T1 ends up working with stale data if T2 does not commit. T2 starts executing and sets x to a new value, T1 starts executing and reads x, the value of x is the value just set by T2, T2 rolls back, the value of x is not persisted to the database but T1 will move forward with the stale value of x that was written before T2 rolled back....

March 24, 2023 · 4 min · poorlydefinedbehaviour