If you have a Python program that is currently running you may want
to understand what the real-world performance profile of the code
is. This program could be in a production environment or just on
your local machine. You will want to understand where the running
program spends its time and if any “hot spots” exist that should be
investigated further for improvement. You may be dealing with a
production system that is misbehaving and you may want to profile it
in an unobtrusive way that doesn’t further impact production
performance or require code modifications. What’s a good way to do
this? This article will talk about
py-spy, a tool that allows you
to profile Python programs that are already running.
This post is for anyone interested in writing performant and safe
applications in Rust quickly. It walks the reader through designing
and implementing an HTTP Tunnel and basic, language-agnostic,
principles of creating robust, scalable, observable, and evolvable
In the evening I noticed that Adam's scorpion, a Heterometrus
silenus, was out of hiding and wandering around in its enclosure
clearly looking for food. So I carefully removed the two enclosures
resting atop the lid and then removed the lid and gave the scorpion a
mealworm with a pair of tweezers. It grabbed the tweezers instead of
the mealworm and the mealworm dropped on the substrate.
But because the mealworm moved slightly against the first right leg of
the scorpion it started to feel around with its claws and
finally found the nice snack.
Speeding up SQL queries by orders of magnitude using UNION
One of the most common cases where SQL query performance can degrade
significantly is in a diamond shaped schema, where there are
multiple ways of joining two tables together. In such a schema, a
query is likely to use OR to join tables in more than one way, which
eliminates the optimizer’s ability to create an efficient query
Some of you read my previous post on
and probably wondered: “what about zope.interface?” I’ve advocated
strongly for it in the
— but now that we have Mypy and Protocols, is it simply a relic of
an earlier time? Can we entirely replace it with Protocol?
An arena is essentially a way to group up allocations that are
expected to have the same lifetime. Sometimes you need to allocate a
bunch of objects for the lifetime of an event, after which they can
all be thrown away wholesale. It’s inefficient to call into the
system allocator each time, and far more preferable to preallocate
a bunch of memory for your objects, cleaning it all up at once once
you’re done with them.
Deep Dive into Docker Internals - Union Filesystem
Working with Docker CLI is very straightforward - you just build,
run, inspect, pull and push containers and images, but have you
ever wondered how do the internals behind this Docker interface
actually work? Behind this simple interface hides a lot of cool
technologies and in this article we will explore one of them - the
union filesystem - the underlying filesystem behind all the
container and image layers...
Just before six p.m. I decided to pop open my late 2014 Mac mini to
see if I could clean it inside with compressed air. Its fan had been
spinning for quite some time non-stop. And even though I had use
compressed air on the outside I had the feeling there was still a lot
of dust inside and the reason for the fan still spinning noisily.
I used a bol.com plastic gift card to pry open the
bottom. A task that was much easier than I had thought; the plastic
lid popped off very easy. And then I noticed how much dust bunnies had
gathered inside the Mac mini... I could pick up most of it with my
hand and used compressed air to blow away the rest.
When I reconnected the Mac mini and turned it on... silence. The dust
was really causing the Mac to overheat, and maybe unstable as well,
and kept the fan spinning.
Exploiting machine learning pickle files
Many machine learning (ML) models are Python pickle
files under the
hood, and it makes sense. The use of pickling conserves memory,
enables start-and-stop model training, and makes trained models
portable (and, thereby, shareable). Pickling is easy to implement,
is built into Python without requiring additional dependencies, and
supports serialization of custom objects. There’s little doubt about
why choosing pickling for persistence is a popular practice among
Python programmers and ML practitioners.
This started with a consulting snafu: Government organisation A got
government organisation B to develop a web application. Government
organisation B subcontracted part of the work to somebody. Hosting
and maintenance of the project was later contracted out to a
private-sector company C. Company C discovered that the
subcontracted somebody (who was long gone) had built a custom Docker
image and made it a dependency of the build system, but without
committing the original Dockerfile. That left company C with a
contractual obligation to manage a Docker image they had no source
code for. Company C calls me in once in a while to do various
things, so doing something about this mystery meat Docker image
became my job.
Over the years of troubleshooting performance problems in the
Unix/Linux world, I have seen multiple cases where a regularly used
command line tool in a customer server just stops working for some
reason. The tool just returns immediately, doing absolutely
nothing. No output printed, no coredumps and the exit code is zero
This article walks you through a couple of such incidents and in the
end I explain how I avoid accidentally doing bad stuff in production
I'm going to tell a story to explain the different concurrency and
parallelism options in Python.
In this story we will see how a single person multitasking is like
concurrency, and multiple people doing their own tasks is like
parallelism. We'll watch these scenarios in action at some well
known lunchtime restaurants as they quickly and efficiently serve
their customers. Then I'll implement these restaurants in Python,
and finally I'll compare the different concurrency options and
explain when to use each one.
What the difference is between concurrency and parallelism?
The different concurrency options and how they compare, including
threading, asyncio, multiprocessing and cloud
The pro and cons of each concurrency option
How to select your concurrency option using a single flowchart
In this series, we look at the most loved languages according to the
Stack Overflow developer survey, the spread and use cases for each
of them and collect some essential links on how to get into
them. First up: Rust.
With the release of FreeBSD 13.0 on the horizon, I wanted to see how
it shapes up on my Lenovo T450 laptop. Previous major releases on
this laptop, using it as a workstation, felt very rough around the
edges but with 13, it feels like the developers got it right.
While others may see Rust and
Go as competitive programming languages, neither
the Rust nor the Go teams do. Quite the contrary, our teams have
deep respect for what the others are doing, and see the languages as
complimentary with a shared vision of modernizing the state of
software development industry-wide.
In this article, we will discuss the pros and cons of Rust and Go
and how they supplement and support each other, and our
recommendations for when each language is most appropriate.
A world at stake. A quest for the ultimate prize. Are you ready?
In the year 2045, reality is an ugly place. The only time Wade Watts
really feels alive is when he’s jacked into the OASIS, a vast
virtual world where most of humanity spends their days.
When the eccentric creator of the OASIS dies, he leaves behind a
series of fiendish puzzles, based on his obsession with the pop
culture of decades past. Whoever is first to solve them will inherit
his vast fortune—and control of the OASIS itself.
Then Wade cracks the first clue. Suddenly he’s beset by rivals
who’ll kill to take this prize. The race is on—and the only way to
survive is to win.
REST, GraphQL, and gRPC are 3 popular forms client-server and
server-to-server communication. Choosing can be difficult, so this
concise guide can help. In each section, an example will be provided
to illustrate retrieving a user.
ARM64 is a computer
that competes with the popular Intel
x86-64 architecture used for
the CPUs in desktops, laptops, and so on. ARM64 is common in mobile
phones, as well as
EC2 instances and the much
ballyhooedApple M1 chips, so knowing
about it might be useful! In fact, I have almost certainly spent
more time with ARM64 than x86-64 because of the iPhone.