Go is a great language to write HTTP servers in, often using just
the included
batteries. This
post shows a few examples of Go servers that serve static
content. The examples range from a very simple purely static file
server to a fairly complete web application bundled into a single Go
program.
Protect your upstream web and application servers by limiting
connections, rate of requests, or bandwidth, based on client IP
address or other variables.
This article explains how to set the maximum number of requests for a
connection, or the maximum rate of downloading content from the
server.
In this article, we will identify the optimal format for structuring
our logs that is easy for humans and machines to parse and
understand. Next, we will highlight the key info to log in addition
to a proposal of data structure. Finally we will try to provide some
important notes to keep in mind for your own projects.
A signal is an event that Linux systems generate in response to some
condition. Signals can be sent by the kernel to a process, by a
process to another process, or a process to itself. Upon receipt of
a signal, a process may take action.
Signals are a core part of Unix-like operating environments and have
existed since more or less the dawn of time. They are the plumbing
for many of the core components of the operating system—core
dumping, process life cycle management, etc.—and in general, they've
held up pretty well in the fifty or so years that we have been using
them. As such, when somebody suggests that using them for
interprocess communication (IPC) is potentially dangerous, one might
think these are the ramblings of someone desperate to invent the
wheel. However, this article is intended to demonstrate cases where
signals have been the cause of production issues and offer some
potential mitigations and alternatives.
One of the most useful, but often misunderstood and misconfigured,
features of NGINX is rate limiting. It allows you to limit the
amount of HTTP requests a user can make in a given period of time. A
request can be as simple as a GET request for the homepage of a
website or a POST request on a log‑in form.
Rate limiting can be used for security purposes, for example to slow
down brute‑force password‑guessing attacks. It can help protect
against DDoS
attacks
by limiting the incoming request rate to a value typical for real
users, and (with logging) identify the targeted URLs. More
generally, it is used to protect upstream application servers from
being overwhelmed by too many user requests at the same time.
In this blog we will cover the basics of rate limiting with NGINX as
well as more advanced configurations. Rate limiting works the same
way in NGINX Plus.
The FreeBSD operating system contains
innumerable powerful features. One of these features is bhyve, its
native type 2 (OS-level) hypervisor, which can host virtual machines
running multiple different OSes, including Linux.
This post will walk you through creating a Linux virtual machine on
FreeBSD using the CBSD tool, which greatly
simplifies creating and managing bhyve VMs.
Docker builds images incrementally. Every line in a Dockerfile will
generate a new image that builds on top of the last one. This can be
really handy if something is not right in your build.
When working with maps in Go, we need to understand some important
characteristics of how a map grows and shrinks. Let’s delve into
this to prevent issues that can cause memory leaks.
A colleague used the patch-branch
technique
of merging a single commit to another branch, but found that the
subsequent merge of the complete branch produced the wrong
results. They asked me to investigate what went wrong.
You know how to view files in Linux. You use cat command or probably
less command for this purpose.
That's good for files that has static content. But log files are
dynamic and their content change with time. To monitor logs, you
need to watch the log file as its content changes.
How do you see the content of log files in real time? Tail is the
most popular command for this purpose but there are some other tools
as well. I'll show them to you in this tutorial.
I hold the opinion that state machines are often misunderstood and
under-applied
And that's why I wrote this. The goal of this list of facts is not
to teach you what state machines are or how to use them; there are
plenty of other resources for that. Rather, the goal here is to
motivate their usage and to highlight things about them that are
frequently overlooked, but nonetheless relevant.
An Interpol agent attempts to expose a high-profile financial
institution's role in an international arms dealing ring.
In the evening I watched The
International. Halfway the
movie I realised that I had seen it before, years ago. Still, I did
like the movie and give it a 7 out of 10.
I recently learnt that mypy has a compiler called
mypyc. The compiler uses standard
python type hints to generate c extensions automatically from python
code. I found the idea very interesting as I have a library
(Lagom - a dependency
injection container) which is fairly extensively annotated with
types. I liked the idea of getting a performance boost without
having to rewrite any code or having to deal with multiple
languages. This blogpost is intended to be a short overview of what
I did, the problems I ran into and the workflow I ended up with.
This is a from-scratch explanation of private information retrieval
built using homomorphic encryption. I try to assume only a general
math / computer science background. To simplify things, my
explanations may not always match academic definitions.
LISTEN / NOTIFY is a feature that enables users to listen to what
goes on in the database. It is one of the oldest
functionalities
in PostgreSQL and is still widely used. The main question is: What
is the purpose of the asynchronous query interface (LISTEN / NOTIFY), and what is it good for? The basic idea is to avoid
polling.
Here are some of the ways you can discover your data processing jobs
are too slow:
Jobs start getting killed when they hit timeouts.
Customers start complaining about slow or failed jobs.
Your cloud computing bill is twice what it was last month.
While these notification mechanisms do work, it’s probably best not
to rely on them. Life is easier when jobs finish successfully,
customers are happy, and you have plenty of money left over in your
budget.
That means you want to identify unexpected slowness or high memory
usage before the situation get that bad. The sooner you can
identify performance problems, the sooner you can fix them.
So how can you identify inefficient tasks in your data pipeline or
workflow? Let’s find out!
Did you know that DOM elements with IDs are accessible in JavaScript
as global variables? It’s one of those things that’s been around,
like, forever but I’m really digging into it for the first time.
Working as a Software Developer, there are always new tools and
frameworks coming out that can completely change your workflows –
for the better (or worse?).
I often find async Rust to be misunderstood. Conversations around
"why async" often focus on performance
1 -
a topic which is highly dependent on workloads, and results with
people wholly talking past each other. While performance is not a
bad reason to choose async Rust, we often we only notice
performance when we experience a lack of it. So I want to instead on
which features async Rust provides which aren't present in
non-async Rust. Though we'll talk a bit about performance too at the
end of this post.
The OpenBSD packet filter PF was
introduced a little more than 20 years ago as part of OpenBSD
3.0. We'll take a short tour of PF
features and tools that I have enjoyed using.