Imagine, that you have a class only with one private variable and one private method with the assertion inside, like:

public class SerializationAssertionCheck implements Serializable {  private int someNumber = 5;  private void check() {    assert someNumber == 5;  }}

Create an object of this class and serialize it to a file. Then comment ‘assert’ command and deserialize the object from the file.

Will it be serialized or not?

- yes, it will

- it will throw some of serialization exception

- it won’t compile

It will throw an InvalidClassException:

java.io.InvalidClassException: net.snatchTech.assertSerialize.SerializationAssertionCheck;local class incompatible: stream classdesc serialVersionUID =…


What do you know about hash? C’mon, I know you’ve heard about hash functions like MD5, SHA-256 & etc.

A hash function is any function that can be used to map data of arbitrary size to fixed-size values. The values returned by a hash function are called hash values, hash codes, digests, or simply hashes. The values are used to index a fixed-size table called a hash table.” © Wikipedia

Okay, thank you Wikipedia, now we also know what is a hash table (or a hash map). But still let me explain how it basically works.

Imagine that you work…


In the previous article we defined what cache is, what we need to know about our data and how to implement different writing policies. Show must go on! And now it’s time to show how records could be forced out of the cache.

Why do we need it?

As I mentioned earlier, hashtable is the most suitable data structure for building a cache system. Because it has O(1) access for both put and get operations (if you have a good hash function which provide a uniform distribution of hash values). But hashtable has O(n) occupied memory space. …


Is your hardware fluttering in futile attempts to speed up the response with frequently used data from the database to the client? Are you tired of spending money on SSD? It’s time to inject cache into your application!

Let’s consider how can we design a cache system and implement some options on java.

What do you need to know about your data & requests?

- validity — how long can you save your data in cache

- durability — can you lose some data or not

- size

- read & write frequency

- latency

- availability

- scalability

If you know your data and estimated requests, you can choose best…


Do you wanna know what queries are currently running and firing your CPU or clogging up your memory? Of course, you do!

Jump for joy! I’ll help you with this Current Queries script (ultimate edition 2.0). Just run it in your SQL Server Management Studio:

WITH XMLNAMESPACES(DEFAULT N’http://schemas.microsoft.com/sqlserver/2004/07/showplan')SELECT  db.name db,  er.session_id sess_id,  er.blocking_session_id block_id,  er.command,  cast(er.total_elapsed_time / 60000.0 as numeric(15,3)) dur_min,  er.total_elapsed_time duration,  DateDiff(MILLISECOND, tat.transaction_begin_time, GETDATE()) tran_duration,  er.cpu_time cpu,  ot.context_switches_count cpu_switches,  er.dop,  er.parallel_worker_count workers,  er.reads,  er.writes,  er.logical_reads logic,  er.row_count rows,  ot.pending_io_count io_count,  ot.pending_io_byte_count io_byte,  tdt.log_recs,  tdt.t_log_recs,  tdt.log_used,  tdt.t_log_used,  tdt.log_reserved,  tdt.t_log_reserved,  er.start_time start,  er.status,  case er.transaction_isolation_level…


Which options do we have?

— Auto-compression TOAST-able data

Postgres Pro compression / encryption

Cstore_fdw columnar store extension

ZSON extension for jsonb format

— Compression file systems (like ZFS or Btrfs)

TimeScaleDB for time-series data

This article is divided into 4 parts:

— First (about auto-compression, postgres pro & Cstore_fdw)

— Second (about ZSON)

— Third (TimeScaleDB)

— Fourth (Compression file systems)

Postgresql auto-compression

Briefly: Postgresql hasn’t row- or page-compression, but it can compress values more than 2 kB. The compressor with default strategy works best for attributes of a size between 1K and 1M.

In detail: Postgresql…


To create custom service you need to know a little about systemd.

systemd — is a suite of basic utilities for Linux. It provides system and service manager runs with PID 1 and starts the rest part of the OS. Systemd manages services, runs daemons, maintain mounting, rules system configuration, logs, monitors incoming users, launching containers and virtual machines & etc.

Since the 8th version of Debian systemd is used by default instead of init.d, which uses unit-files from the /etc/systemd/system directory, instead of the scripts from /etc/init.d/, respectively.

systemctl — the general command to control and monitor systemd state…


So, your project has lived up to production and you’d like to start it with the OS and you don’t manually rise it every time. But how do we do that with a regular jar-file?

There are a bunch of options:

I) Put the bat-file with java –jar launch or exe-file in Windows startup (after making an exe file from jar).

Windows 7 : C:\users\All Users\Start Menu\Programs\Startup(Admin) or User home directory(%userProfile%)Windows 10 : In Run shell:startup

This will solve the problem, but your app will start in the best case only with the first login of any user (if…


After connecting the next bases to monitoring services, that are actively cluttering up postgres tables with lots of interesting data, during drawing the couple panels grafana choked and said: could not resize shared memory segment “/PostgreSQL.2018052794” to 40935124 bytes: No space left on device.

No space left on device? Really? — I thought, but didn’t argue. Maybe the disks are full? Nope, I just truncated all big tables an hour ago.. Wait a minute, the message tells us about shared memory, and Postgres runs into Docker container.

It’s kind of «file metadata» tables, and it can reach their maximum number…


Old-school engineers code in notebooks, compiling files through the terminal. Cool guys write bytecode directly. But lazy progers use project-building systems like Accumulator of knowledge (or for those who don’t know Yiddish — Apache Maven) integrated into the IDE (or lying somewhere close by to warm the soul by starting the build from the terminal periodically).

So how can our friend help?

— downloads the libraries you need automatically, if you, for example, wanna parse json or use jdbc connector, but writing it all is too lazy. There is a huge jar-database in the central repository.

— runs processing of…

Alex Kuk

java development, volleyball, performance engineering, kudo, deep learning

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