Apache Kafka - Uneven load across disks and brokers - apache-kafka

I have 2x broker Kafka setup running on EC2, each with 4x4GB GP2 SSDs, the topic has 6 partitions and 1 replica. They drives mounted and I have set them up in the server.properties. But when I was load testing my system and seeing what was happening with the drives, 1 of the 4 drive on broker 1 had a had stored a lot of the data, eg of what I got:
Broker 1: ** NOTE: I manually reproduced the figures for mount /a for the post ***
Filesystem Size Used Avail Use% Mounted on
udev 16G 12K 16G 1% /dev
tmpfs 3.2G 344K 3.2G 1% /run
/dev/xvda1 7.8G 1.3G 6.1G 17% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
none 5.0M 0 5.0M 0% /run/lock
none 16G 0 16G 0% /run/shm
none 100M 0 100M 0% /run/user
/dev/xvdg 3.9G 8.0M 3.6G 1% /b
/dev/xvdf 3.9G 600M 3.2G 17% /a
/dev/xvdh 3.9G 8.0M 3.6G 1% /c
/dev/xvdi 3.9G 8.0M 3.6G 1% /d
Broker 2:
Filesystem Size Used Avail Use% Mounted on
udev 16G 12K 16G 1% /dev
tmpfs 3.2G 344K 3.2G 1% /run
/dev/xvda1 7.8G 1.3G 6.1G 17% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
none 5.0M 0 5.0M 0% /run/lock
none 16G 0 16G 0% /run/shm
none 100M 0 100M 0% /run/user
/dev/xvdg 3.9G 8.0M 3.6G 1% /b
/dev/xvdf 3.9G 8.0M 3.6G 1% /a
/dev/xvdh 3.9G 8.0M 3.6G 1% /c
/dev/xvdi 3.9G 8.0M 3.6G 1% /d
Can someone explain what is happening and if I have set something up wrong? I thought they were supposed to be approx even across all drives?

When you send load over Kafka, the producer uses a Partitioner implementation over the set of keys being sent, in order to work out which partition to write the message into. The default Partitioner implementation uses a hashing function. If you send all of your messages with the same key, then they will all hash into the same partition. The same can be true of a small set of keys - hashing often produces uneven distributions.
Your best bet is to use a larger key set, or configure the producer with a Partitioner that performs a more even distribution of messages - via round-robin for example. Whether this is something you want to do depends on whether you have a requirement to ensure that some messages are processed in order, in which case you should ensure that related messages use the same key, and take this into account in your Partitioner.

Related

Why does it show I have no disk space left while I still have a lot of space available?

I am on a CentOs system, and df shows that I have a lot of disk spaces available:
See this command:
$ git pull
fatal: write error: No space left on device
$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 30G 4.2G 24G 15% /
devtmpfs 63G 0 63G 0% /dev
tmpfs 63G 0 63G 0% /dev/shm
tmpfs 63G 435M 63G 1% /run
tmpfs 63G 0 63G 0% /sys/fs/cgroup
/dev/sda2 30G 28G 0 100% /usr
/dev/sda7 148G 24G 118G 17% /data0
/dev/sda6 30G 1.3G 27G 5% /var
/dev/sda5 30G 45M 28G 1% /tmp
/dev/sdc1 3.9T 462G 3.3T 13% /data1
/dev/sdb1 274G 107G 154G 42% /data2
tmpfs 13G 0 13G 0% /run/user/60422
And I am currently running the git pull command under /data1, which has 87% spaces left.
Why is that?
EDIT:
df -ih
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/sda1 1.9M 14K 1.9M 1% /
devtmpfs 16M 610 16M 1% /dev
tmpfs 16M 1 16M 1% /dev/shm
tmpfs 16M 1022 16M 1% /run
tmpfs 16M 16 16M 1% /sys/fs/cgroup
/dev/sda2 1.9M 344K 1.6M 18% /usr
/dev/sda7 9.5M 58K 9.4M 1% /data0
/dev/sda6 1.9M 14K 1.9M 1% /var
/dev/sda5 1.9M 35 1.9M 1% /tmp
/dev/sdc1 251M 160K 251M 1% /data1
/dev/sdb1 18M 1.2K 18M 1% /data2
tmpfs 16M 1 16M 1% /run/user/60422
Maybe you are running out of inodes? Check with df -ih.

is it possible to decrease swap partition space in centos7

Some of my friends told me that larger swap partition is very bad like thousands of web hits/min should be possible on my server,
The swap space is 16 GB, and i installed centos7 with "CWP" -> Control web panel
with enable csf, should i consider decrease swap partition space if it possible without formatting the server and how? or there is a solution to maintain this space not to harm the server,,
[root#server ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 16G 0 16G 0% /dev
tmpfs 16G 0 16G 0% /dev/shm
tmpfs 16G 201M 16G 2% /run
tmpfs 16G 0 16G 0% /sys/fs/cgroup
/dev/sda2 1.8T 256G 1.5T 15% /
/dev/sdb1 1.8T 275G 1.5T 16% /backup
/dev/sda5 16G 83M 15G 1% /tmp
/dev/sda1 969M 187M 716M 21% /boot
tmpfs 3.2G 0 3.2G 0% /run/user/0
tmpfs 3.2G 0 3.2G 0% /run/user/1075
[root#server ~]#
I found that swap file i more effective and easier to do in my case, so i disabled the swap partition and created a swapfile instead..
Here how you do it exactly.

Openshift v3 space consumption check

Can anyone tell me how do I check the current available volume, consumed space, on my Mongodb pod on the new Openshift Online Platform? After allocating around 4GB of space, I am unclear on what's the volume that has been consumed until now.
Any light thrown on this will help. Thank you.
You can run oc exec <mongodb_pod> -- df -H .
For example, I get the following output when I run it for the sample python app in my cluster:
$ oc exec os-sample-python-1-hrbq7 -- df -H
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/docker-253:1-94278-dbe79cf53785ab8a1b083f53c88088ab667a01f45e8a8725b26fbff82eef2a33 11G 689M 11G 7% /
tmpfs 4.2G 0 4.2G 0% /dev
tmpfs 4.2G 0 4.2G 0% /sys/fs/cgroup
/dev/vda1 11G 3.0G 7.8G 28% /etc/hosts
shm 68M 0 68M 0% /dev/shm
tmpfs 4.2G 17k 4.2G 1% /run/secrets/kubernetes.io/serviceaccount
tmpfs 4.2G 0 4.2G 0% /proc/scsi

How to get more space on /dev/mapper/centos-root

The following is df -h result. /dev/mapper/centos-root is 100%.
/dev/mapper/centos-root 50G 50G 20K 100% /
devtmpfs 3.8G 0 3.8G 0% /dev
tmpfs 3.9G 8.0K 3.9G 1% /dev/shm
tmpfs 3.9G 8.9M 3.8G 1% /run
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/mapper/centos-home 406G 5.0G 401G 2% /home
/dev/sda3 497M 303M 195M 61% /boot
tmpfs 780M 0 780M 0% /run/user/0
tmpfs 780M 0 780M 0% /run/user/1000
I removed a lot of large files (nGB) in $HOME and $HOME/Downloads. But there is no change in df -h result.
Could you tell me where I should remove files to get more space on /dev/mapper/centos-root?
Your Home directory is mounted from partition
/dev/mapper/centos-home
Try deleting unimportant files for example in
/tmp/
If you want to examine the file sizes have a look at the du command
The following is df -i result. /dev/mapper/vg00-lv_var 6553600 6553600 0 100% /var
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/mapper/vg00-lv_root 49856512 220435 49636077 1% /
devtmpfs 16444850 583 16444267 1% /dev
tmpfs 16448811 6 16448805 1% /dev/shm
tmpfs 16448811 986 16447825 1% /run
tmpfs 16448811 16 16448795 1% /sys/fs/cgroup
/dev/sda2 32768 35 32733 1% /boot
/dev/sda1 0 0 0 - /boot/efi
/dev/mapper/vg00-lv_var 6553600 6553600 0 100% /var
tmpfs 16448811 17 16448794 1% /run/user/42
tmpfs 16448811 1 16448810 1% /run/user/0
tmpfs 16448811 1 16448810 1% /run/user/99

Raspberry Pi Filesystem

I have a problem which I can't find the answer to anywhere online - so I thought I would ask it here. Below is a code snippet of the directories in my Raspberry Pi. I have a 16GB SD Card installed in my Pi, and the total size of all those directories is only about 5GB. When I try and install anything it says "Out of Memory", and I have already cleared all log files, etc to try and free up space.
But the real question is, why does it say full when it has a 16GB card and I've only installed apache2 and php5 on it?
edward#raspberrypi:/ $ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 3.6G 3.5G 0 100% /
devtmpfs 214M 0 214M 0% /dev
tmpfs 218M 0 218M 0% /dev/shm
tmpfs 218M 4.6M 213M 3% /run
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 218M 0 218M 0% /sys/fs/cgroup
/dev/mmcblk0p1 60M 20M 41M 34% /boot
tmpfs 44M 0 44M 0% /run/user/1000
tmpfs 44M 0 44M 0% /run/user/1001
Thanks for any help.
Try to type in: raspi-config and after that a menu pops up, with the option to expand your file system.