Facebook Twitter GitHub LinkedIn LinkedIn LinkedIn
May 24, 2022
A photograph of a snail attempting to cross the gap between two large rocks. The snail is climbing out of the gap and onto one of the rocks, apparently traveling from the opposite one.

Essential elements of high performance applications

SQL indexes

By Christian Charukiewicz  —  performance-optimization sql essential-elements-of-high-performance

There are many aspects that go into making a fast application. Web application performance is a broad topic because there are numerous concerns in making a page load quickly or a button click feel responsive. One of the difficulties developers must grapple with in pursuit of performance is that any one of these facets can become a bottleneck if overlooked.

Building fast web applications requires a comprehensive understanding and examination of the entire system. In this post, we kickoff a series that covers essential elements that go into building high performance web applications. Throughout this series, we are going to discuss the performance of web applications written in a high level language (such as PHP or Python), backed by a SQL database, and where the frontend interacts with the back end through HTTP requests that download HTML, JSON, or a combination of both, since this structure is the most common one found today.

Read the whole post
July 26, 2021
A photograph of an old European house, with different portions of the facade build from distinct materials, such as stone, red brick, white brick.

Composable Data Validation with Haskell

By Ben Levy and Christian Charukiewicz  —  haskell

Recently, a client asked us to work on a new Rules Engine for them. This system serves as the back end to a highly configurable dashboard where non-technical users define business rules for how a certain component of the system behaves. When deployed, this system has to handle a substantial production workload, so performance is also a key consideration.

Read the whole post
May 27, 2021
A photograph of what appears to be a farmer's market stand containing a variety of squashes, including butternut, kabocha, and delicata.

Final tagless encodings have little to do with typeclasses

By Ben Levy  —  haskell

There’s a common misconception as to what final tagless, and more specifically, a final encoding is. A common claim I see is that final tagless means coding against typeclasses. The mtl library and code written in MTL style are raised as examples of final tagless.

I would like to argue that what people are referring to as final tagless is in fact just coding against an interface and that the novelty of final tagless really has very little to do with abstract interfaces. So then what is final tagless? It’s a complicated name for a not-so-complicated idea.

Read the whole post
March 19, 2021
A picture of a construction crew working: one constructor worker is operating a small excavator, while three others are observing him doing his work.

Speeding up SQL queries by orders of magnitude using UNION

By Ben Levy and Christian Charukiewicz  —  sql performance-optimization

SQL is a very powerful tool for querying data. It allows you to write queries against your relational data in a declarative manner, letting you describe what data that you want to retrieve without having to describe how to retrieve it. In most cases, this works very well, and the query optimizer in many database engines (MySQL, PostgreSQL, etc.) will create an efficient query plan.

Efficient query plans rely on a schema that uses appropriate data types, especially for primary key columns, where doing things such as misusing VARCHAR can kill performance. Another critical element of enabling fast query plans is appropriately indexing columns, which eliminates the need to perform full table scans when retrieving data. Unfortunately, even following these schema rules, it’s possible to write SQL queries that have surprisingly poor performance, often leading to the bewilderment of the developer writing such a query. Perhaps the most surprising aspect of this type of query is that it is often written in the most intuitive way to describe the data.

Read the whole post
January 11, 2021
A symmetrical photograph of what appears to be two identical buildings. The perspective of the photograph is from the middle of the two buildings, looking up towards the sky. There is a reflection of the opposite building in each building's windows.

Why Haskell is our first choice for building production software systems

By Christian Charukiewicz  —  haskell

Haskell is the first programming language we reach for when we build production software systems. This likely seems unusual to anyone who only has a passing familiarity with the language. Haskell has a reputation for being an advanced language with a steep learning curve. It is also often thought of as a research language with limited practical utility.

While Haskell does have a very large surface area, with many concepts and a syntax that will feel unfamiliar to programmers coming from most other languages, it is unrivaled in the combination of developer productivity, code maintainability, software reliability, and performance that it offers. In this post I will cover some of the defining features of Haskell that make it an excellent, industrial-strength language that is well-suited for building commercial software, and why it is usually the first tool we consider using for new projects.

Read the whole post