Full Width [alt+shift+f] Shortcuts [alt+shift+k]
Sign Up [alt+shift+s] Log In [alt+shift+l]

Evan Jones - Software Engineer | Computer Scientist

Evan Jones -...
The C Standard Library Function isspace() Depends on Locale This is a post for myself, because I wasted a lot of time understanding this bug, and I want to be...
a year ago
68
a year ago
This is a post for myself, because I wasted a lot of time understanding this bug, and I want to be able to remember it in the future. I expect close to zero others to be interested. The C standard library function isspace() returns a non-zero value (true) for the six "standard"...
Evan Jones -...
How much does the read/write buffer size matter for socket throughput? The read() and write() system calls take a variable-length byte array as an argument. As a...
a year ago
59
a year ago
The read() and write() system calls take a variable-length byte array as an argument. As a simplified model, the time for the system call should be some constant "per-call" time, plus time directly proportional to the number of bytes in the array. That is, the time for each call...
Evan Jones -...
Huge Pages are a Good Idea Nearly all programs are written to access virtual memory addresses, which the CPU must translate to...
over a year ago
33
over a year ago
Nearly all programs are written to access virtual memory addresses, which the CPU must translate to physical addresses. These translations are usually fast because the mappings are cached in the CPU's Translation Lookaside Buffer (TLB). Unfortunately, virtual memory on x86 has...
Evan Jones -...
TCP and gRPC Failed Connection Timeouts After my last article about how gRPC is hard to configure, with a client keepalive example, I...
over a year ago
31
over a year ago
After my last article about how gRPC is hard to configure, with a client keepalive example, I realized that I don't understand how TCP and gRPC handle failed connections. This article is my attempt to figure it out, and document it so I can find it again in the future. The best...
Evan Jones -...
Replicating Database Changes to a Message Queue is Tricky Let's imagine we have an program that stores its state in a database, and we want other programs to...
over a year ago
30
over a year ago
Let's imagine we have an program that stores its state in a database, and we want other programs to do things when changes occur. For example, we might want to send email notifications if a bank balance drops below a threshold. This is a very common reason applications use...
Evan Jones -...
Setenv is not Thread Safe and C Doesn't Want to Fix It You can't safely use the C setenv() or unsetenv() functions in a program that uses threads. Those...
a year ago
29
a year ago
You can't safely use the C setenv() or unsetenv() functions in a program that uses threads. Those functions modify global state, and can cause other threads calling getenv() to crash. This also causes crashes in other languages that use those C standard library functions, such as...
Evan Jones -...
Postgres large sub-string query performance Following up on my last post about large JSON queries, I also benchmarked sub-string queries on...
over a year ago
29
over a year ago
Following up on my last post about large JSON queries, I also benchmarked sub-string queries on large variable-length strings. I wanted to check if sub-string queries might be faster than HSTORE or JSONB key lookups. I tested both binary (BYTEA) and Unicode text (TEXT)....
Evan Jones -...
Go: Functional options are slow The Go "functional options" pattern is a way of passing options to a function. The function takes a...
over a year ago
27
over a year ago
The Go "functional options" pattern is a way of passing options to a function. The function takes a variable number of arguments, which are themselves functions (a type like ...func(*config). I think it was first introduced by Rob Pike in a 2014 blog post. It is now used by many...
Evan Jones -...
Network Latencies in the Data Center Jeff Dean used to do a talk that included "Numbers Everyone Should Know" (2007 at Stanford, 2009 at...
over a year ago
26
over a year ago
Jeff Dean used to do a talk that included "Numbers Everyone Should Know" (2007 at Stanford, 2009 at LADIS), which included "round trip within same data center" as 500 us. I was recently wondering if that is still true, and more importantly what does the distribution of latencies...
Evan Jones -...
Advice on looking for a new software engineering job I've been working professionally as a software engineer since 2006, which means I've been doing this...
over a year ago
25
over a year ago
I've been working professionally as a software engineer since 2006, which means I've been doing this long enough that people now ask me for advice. I've only changed jobs 3 times in my career, so I'm not sure I'm an expert. However, I decided I should write down my advice, to...
Evan Jones -...
Postgres large JSON value query performance Postgres supports three types for "schemaless" data: JSON (added in 9.2), JSONB (added in 9.4), and...
over a year ago
25
over a year ago
Postgres supports three types for "schemaless" data: JSON (added in 9.2), JSONB (added in 9.4), and HSTORE (added in 8.2 as an extension). Unfortunately, the performance of queries of all three gets substantially slower (2-10×) for values larger than about 2 kiB, due to how...
Evan Jones -...
Getting $3300 from a casino promotion New York State legalized mobile sports gambling in January 2022. The casinos offered crazy...
over a year ago
24
over a year ago
New York State legalized mobile sports gambling in January 2022. The casinos offered crazy promotions to get people signed up. The craziest offered $3300 of free money. I did the math, and there was a low risk way to claim this money. As long as you placed 11 or more bets, you...
Evan Jones -...
gRPC is easy to misconfigure Google's gRPC is an RPC system that supports many languages, and is relatively widely used. I think...
over a year ago
22
over a year ago
Google's gRPC is an RPC system that supports many languages, and is relatively widely used. I think its popularity is due to being used for parts of Docker and Kubernetes. I think gRPC is mostly fine, but it is surprisingly easy to screw up by misconfiguring it. Part of that is...
Evan Jones -...
Random Load Balancing is Unevenly Distributed This is a reminder that random load balancing is unevenly distributed. If we distribute a set of...
a year ago
18
a year ago
This is a reminder that random load balancing is unevenly distributed. If we distribute a set of items randomly across a set of servers (e.g. by hashing, or by randomly selecting a server), the average number of items on each server is num_items / num_servers. It is easy to...
Evan Jones -...
Nanosecond timestamp collisions are common I was wondering: how often do nanosecond timestamps collide on modern systems? The answer is: very...
a year ago
16
a year ago
I was wondering: how often do nanosecond timestamps collide on modern systems? The answer is: very often, like 5% of all samples, when reading the clock on all 4 physical cores at the same time. As a result, I think it is unsafe to assume that a raw nanosecond timestamp is a...