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.
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.
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.
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.
I downloaded that CSV file for testing:
du -sh part.csv
All tests running on MacBook Pro (16-inch, 2019) 8-Core Intel Core i9 with 16 GB ram.
All tests with provided…
Hey, medium! Today I will tell you about a new instrument for converting gelf messages to Sentry.
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).
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.
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?
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.
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 is a fast key-value database that stores data in memory.
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.
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.
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.
wg := new(sync.WaitGroup)
Abuse it. Abuse like it the last abuse in you life.
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.
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…
Software Developer from VK