Choosing the best algorithms is very important, but how we can speed up the already chosen algorithms?


Today, I will show you how we can speed up the mergesort algorithm more than five times on 100 elements in an array with the arena allocator.


In this chapter, we will talk about minimal theory, which you need to understand before we will talk about arena allocators.

Memory allocation

Almost every step in your code needs some memory. When we need to save some state, we need to ask for memory from OS. For doing that we have the two ways:

1) Static memory…

Hey! Recently I had a little researching about how mutexes works. The result of my research is the new cargo crate fast-async-mutex. In this crate, I built a stupid async mutex and more complexity mutex, which check the locking ordering. And now I wont to write a series of posts about mutexes in the Rust. And the first article will about a maximum simple and stupid mutex which we can make.

Firstly let’s understand what’s mutexes do

By default, mutexes have two methods: acquire and release it also named as lock and unlock. When some thread calls a acquire method, the mutex will change its own…

Hey, medium! Graylog is a popular instrument for log processing, storing and analyzing. But Sentry is a more useful instrument, which gives to us more opportunities.

If you want to migrate log processing to Sentry you must change a lot of code, configs, and the same logic which describe your architecture. Also, you can not know, do you need Sentry or no? To make the final decision you need to make an experiment, with the simplest realization as possible.

Just all of you need it is a one instrument

The simplest solution will be up an adapter, which will accept messages instead of Graylog, convert and sent them to Sentry.

Hey, Medium! Yesterday I read an interesting article about writing faster analog wc in Haskell. So… After reading I thought about writing some tools in Rust but it so boring I think. And I decided to write a simple sort tool in Rust and benchmark it.


I know what Unix sort do much more work than rust solution and all of the benchmarks there did just for fun.


Testing data

I downloaded that CSV file for testing:

du -sh part.csv                                                              
179M part.csv


All tests running on MacBook Pro (16-inch, 2019) 8-Core Intel Core i9 with 16 GB ram.

Testing tool

All tests with provided…

Hey, medium! Today I will tell you about a new instrument for converting gelf messages to Sentry.

Sentry dashboard example


What’s gelf?

The Graylog Extended Log Format (GELF) is a log format that avoids the shortcomings of classic plain syslog.

When may you use gelf? Gelf is one of the most popular log transfer protocols. It’s supported by docker out of the box, also it has default support from most popular frameworks (like PHP monolog).

What’s sentry?

Sentry is a monitoring and logs aggregating system, which has a user-friendly interface.

Sentry is an open-source company, providing an application monitoring platform that helps you identify issues in real-time.

Passing Gelf messages to Sentry

Hey! Today I will talk to you about Nginx Unit. What is the service architecture hell? What’s to do when you have too much services which written are in different programming languages?

Our story

We have services written in php, node js and golang. Also for the running of it we have the Nginx web server, php-fpm and node js with go. Every instance of the service allocate some port and it’s routed with nginx rules.

The problem

For running our services we must do the ports management, write and support nginx configs, php-fpm configs, etc. …

If you use Redis only for cache — you do not never used Redis.

Картинки по запросу redis

Ok. What’s redis?

Redis is a fast key-value database that stores data in memory.

The official site talk us:

Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache and message broker. It supports data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs, geospatial indexes with radius queries and streams.

Why it’s so popular?

The Redis used by top companies like as (redis have official lists of companies here):

Because Redis is not only fast, but also…

When to use sync.WaitGroup? Why? How? Writing own service to interact with other services. Mega parallelism in go. X5 performance boost bench below in post.

What is the sync.WaitGroup?

WaitGroup allow us blocking function execution until all goroutines within that WaitGroup have successfully executed.

The comments on sync/waitgroup.go say that:A WaitGroup waits for a collection of goroutines to finish. The main goroutine calls Add to set the number of goroutines to wait for. Then each of the goroutines runs and calls Done when finished. At the same time, Wait can be used to block until all goroutines have finished.

sync.WaitGroup usage

WaitGroup is the simple for use:

wg := new(sync.WaitGroup)
go func()…

Abuse it. Abuse like it the last abuse in you life.

Node.js is an open-source, cross-platform JavaScript run-time environment that executes JavaScript code outside of a browser. Node.js lets developers use JavaScript to write command line tools and for server-side scripting — running scripts server-side to produce dynamic web page content before the page is sent to the user’s web browser. Consequently, Node.js represents a “JavaScript everywhere” paradigm, unifying web application development around a single programming language, rather than different languages for server side and client side scripts.

Stop. Why NodeJs?

Because it’s fast, it’s simple.

We can do the server side rendering…

In the grim darkness of the far future, there is only data loss. Making simple data replication for you applications.

Syncing data with 12k requests/sec messages between instances

Replication. What is it?

Data replication is the process of syncing data between you services (databases, applications, etc). It can help you not to lose data in critical incidents and easily scale the increasing load on your services.

Replication description from the Wiki:
Replication in computing involves sharing information so as to ensure consistency between redundant resources, such as software or hardware components, to improve reliability, fault-tolerance, or accessibility.

For example, also you can save the limits of third-party api services, if only one…

Mikhail Panfilov

Software Developer from VK

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store