For the modern computers, they mostly have multiple CPU cores. We can use Python’s multiprocessing module to automatically get the number of CPU cores. Then we use this module to spawn corresponding processes to generate load on all the CPU cores concurrently.

Read more »

Check the current installed data directory

[ec2-user@ip-192-168-93-151 ~]$  psql -h 192.168.28.223 -U postgres -d postgres
Password for user postgres:

postgres=# SHOW config_file;
             config_file
-------------------------------------
 /var/lib/pgsql/data/postgresql.conf
(1 row)

postgres=# SHOW data_directory;
   data_directory
---------------------
 /var/lib/pgsql/data
(1 row)
Read more »

Download and install updates

[ec2-user@ip-192-168-28-223 ~]$ cat /etc/os-release
NAME="Amazon Linux"
VERSION="2"
ID="amzn"
ID_LIKE="centos rhel fedora"
VERSION_ID="2"
PRETTY_NAME="Amazon Linux 2"
ANSI_COLOR="0;33"
CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2"
HOME_URL="https://amazonlinux.com/"
[ec2-user@ip-192-168-28-223 ~]$ cat /etc/system-release
Amazon Linux release 2 (Karoo)

[ec2-user@ip-192-168-28-223 ~]$ sudo yum update -y
Read more »

Install PostgreSQL

Refer to this post to install PostgreSQL.

Intro to pgbench

pgbench is a simple program for running benchmark tests on PostgreSQL. It runs the same sequence of SQL commands over and over, possibly in multiple concurrent database sessions, and then calculates the average transaction rate (transactions per second). By default, pgbench tests a scenario that is loosely based on TPC-B, involving five SELECT, UPDATE, and INSERT commands per transaction. However, it is easy to test other cases by writing your own transaction script files.

Available built-in scripts are: tpcb-like, simple-update and select-only.

Read more »

Problem statement

By default, the TCP connection to PostgreSQL is disallowed. You would see the following like error when you try to connect.

# su - postgres
-bash-4.2$ psql --host=10.10.10.243 --port=5432 --username=postgres -w -c "\l"
psql: error: connection to server at "10.10.10.243", port 5432 failed: Connection refused
Is the server running on that host and accepting TCP/IP connections?
Read more »

Intro

A hard link acts as a copy (mirrored) of the selected file. It accesses the data available in the original file. If the earlier selected file is deleted, the hard link to the file will still contain the data of that file.

A soft link (aka Symbolic link) acts as a pointer or a reference to the file name. It does not access the data available in the original file. If the earlier file is deleted, the soft link will be pointing to a file that does not exist anymore.

Read more »

It might be necessary to emulate a slow block device when you don’t have a slow disk for debugging some high latency performance issue. The device mapper driver in Linux provides a solution called “delay” target.

Read more »

fsstat displays the details associated with a file system. The output of this command is file system specific. At a minimum, the range of meta-data values (inode numbers) and content units (blocks or clusters) are given. Also given are details from the Super Block, such as mount times and and features. For file systems that use groups (FFS and EXT2FS), the layout of each group is listed. For a FAT file system, the FAT table is displayed in a condensed format. Note that the data is in sectors and not in clusters.

Read more »
0%