Store PHP sessions in Memcache or Redis

You can store PHP sessions in Memcache or Redis. High traffic websites with multiple application nodes choose either sticky sessions with file session storage (recommended) or centralized Memcache or Redis session storage. If you choose Memcache or Redis you should NOT rely on your favorite framework’s implementation (see: “A session locking test suite for PHP”). But even if you rely on native implementations in PHP extensions you may run into wrong default values. This post explains you how to configure PHP session storage in Memcache and Redis and test that it locks properly. ...

January 3, 2025 · Maurits van der Schee

Install PHP memcache in PHP 8.3

Memcache is a very fast cache that is a great addition to MariaDB and PHP. It is simpler and more performant than Redis. I prefer Redis for session storage and Memcache for application caching in my (high-performance) PHP projects. Installing Memcache is very easy (on any Debian based Linux), all you have to do is type: sudo apt install memcached In order to allow PHP to talk to Memcache you need the “php-memcache” extension. You can install that with: ...

January 1, 2025 · Maurits van der Schee

GopherCon Europe 2024 and 2023

GopherCon Europe is a well known Go conference. We are listing the GopherCon Europe 2023 and 2024 conference videos. The videos are posted on the GopherCon Europe Youtube channel and are linked below. GopherCon Europe 2024 Martin Gallauner - From Java to Go: I Have a Hammer and See Nails Everywhere (16:54) Robert Laszczak - Rethinking Domain-Driven Design in Go (28:41) Raghav Roy - Using Formal Reasoning to Build Concurrent Go Systems (29:27) Zvonimir Pavlinovic - Securing Containers Against Known Go Vulnerabilities (21:55) Felix Geisendörfer - How to Win Frames and Influence Pointers @felixge (28:02) Rabieh Fashwall - Unraveling Go Anti-Patterns (29:46) Hila Fish - Technical Documentation (29:49) Jonathan Amsterdam - HTTP Routing Enhancements (25:31) Chioma Onyekpere - Leveraging Go for Efficient Infrastructure & Data Handling (12:12) Travis Cline - Building AI Applications in Go (28:12) Go Team Panel (45:36) Go in DevOps Panel (43:09) Agniva de Sarker - A Deep Dive into the DB Connection Pool (13:00) Go Time Podcast (44:01) Diana Shevchenko - Memory Optimization through Structure Packaging (14:23) Cameron Balahan - The Business of Go (28:38) GopherCon Europe 2023 Cameron Balahan - Keynote: The State Of Go (27:51) Xe Iaso - Reaching the Unix Philosophy’s Logical Extreme with Webassembly (23:36) Robert Grandl - Towards Modern Development of Cloud Applications (26:46) Björn Rabenstein - How to Avoid Breaking Changes in your Go Modules (26:30) Yiscah Levy Silas - Go Right Ahead! Simple Hacks to Cut Memory Usage by 80& (20:59) Maciej Rzasa - API Optimization Tale: Monitor, Fix and Deploy (24:14) Julie Qiu - Vulnerability Management for Go (24:17) Jonathan Amsterdam - A Fast Structured Logging Package (25:37) Go Panel (42:37) Drishti Jain - Go Beyond the Console: Developing 2D Games in Go (29:04) Ayesha Kaleem - Gentle Introduction to EBPF (19:47) Julien Cretel - Useful Functional-Options Tricks for Better Libraries (27:07) Giuseppe Scaramuzzino - Unleashing Desktop App Development with Go and Fyne (4:45) Robert Burke - I’m Excited to Use Generics in Go 1.21 (7:02) Yolan Romailler - TLOCK: Encrypting Messages to the Future in Go (5:27) Yusef Mohamadi - Race Conditions in Details (6:38) Ron Evans - A Small Update on Tiny Go (8:36) GoTime Podcast Live (28:56) Elena Grahovac - Why Integration Tests Might be Better than Unit Tests (25:59) Mohammed Al Sahaf - The Road to CGO-Less is Paved (30:39) Roman Khavronenko - Writing a TSDB from Scratch: Performance Optimization (25:48) Yarden Laifenfeld - Go Sync or Go Home (28:43) Enjoy! ...

December 26, 2024 · Maurits van der Schee

Install Debian 12 with modern XFCE themes

I often choose Linux Mint XFCE when I need a good looking and comfortable system quick. But sometimes I’d rather have a more stable system and match what I have on the server, which is Debian 12 with XFCE. Unfortunately Debian with XFCE doesn’t look as good as Mint with XFCE. In this post I’ll explain what you can do to make Debian look like Mint/Xubuntu and suitable for everyday use. ...

November 28, 2024 · Maurits van der Schee

Can you afford to cloud compute?

Data centers promise better and cheaper physical security, rented hardware, electricity and connectivity than you can have on-premise, because of the scale on which these companies operate. I think that is often true and that that’s is why most companies moved their machines to racks in data-centers that are well connected to the Internet. What is cloud computing? Most people nowadays agree that even though your servers are not owned by you or on-premise, this does not make it “cloud computing” or even “cloud native”. In general people believe that cloud is more than “just someone else’s computer” as argued here. Cloud computing has become a term used for good engineering practices in the data-center. ...

November 17, 2024 · Maurits van der Schee

Scaling to 1 million websockets in PHP

A client asked me: How does one scale software to handle 1 million websocket connections? At 1000k connections when every client sends only one message per 30 seconds you have to deal with 33333 websocket messages per second. Dealing with that many requests per second is well understood in HTTP, but unfortunately these are messages on a websocket. Nevertheless, let’s assume that these are HTTP requests for now. 33k requests per second in PHP Laravel behind Nginx can do 2908 requests per second on a Dell R440 Xeon Gold + 10 GbE when the average API call is 20 database queries per request (see here). This means that in order to handle 33333 API requests for 1 million websockets you need a minimum of 12 of these machines. Also, the corresponding 666k queries per second may need horizontal scaling of the database (unless the queries are really cheap, see here). ...

November 14, 2024 · Maurits van der Schee

Running Debian 12 on Windows with WSL 2

So, maybe your employer want you to use Windows. Obviously you still want to use Linux as you want to run whatever operating system your production servers run. If running Virtualbox or VMWare causes too much switching between environments then WSL might be a solution. In this post I’ll show how to install WSL 2 with Debian 12 as the Linux distribution. First we show which Linux distributions you can choose from, by running (from the command prompt): ...

October 1, 2024 · Maurits van der Schee

Distributed metrics in PHP using Go and Gob

In the previous post I showed how to do high frequency metrics in PHP with TCP sockets. In this post I’ll show how to collect and combine metrics from multiple PHP application servers. Instead of sending the log lines from each server to a single node, the monotonically increasing counters from all PHP application server’s metrics HTTP end-points are scraped and added up. The transfer of the metrics is done using Go’s very efficient Gob protocol (over HTTP). ...

September 25, 2024 · Maurits van der Schee

High frequency metrics in PHP with TCP sockets

When you are running a high traffic website you may run multiple PHP servers to handle the load. When you want to track a performance metric (such as API or database calls) you may need to do some high frequent logging for performance analysis. In this blog post we present a standardized (and tested) way to do this with minimal impact. A line logging performance may look like this: log( [metric name], [label name], [label value], [duration in seconds] ) The current implementation supports labeling each measurement with a single label. ...

September 23, 2024 · Maurits van der Schee

GMKtec NucBox G5: a tiny Linux PC

I don’t like laptops, neither to own nor to work on. They are very costly, are hard to repair or upgrade and I get neck and back pain from working on them. I love to work at places where the desk is (properly) equipped with (height-adjustable) monitor, keyboard and mouse. Most companies provide laptops to use on such desk setups for maximum flexibility, but I would rather have a GMKtec NucBox G5. ...

September 1, 2024 · Maurits van der Schee