Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kafka failed to map 1073741824 bytes for committing reserved memory

Tags:

apache-kafka

I am installing kafka on an aws t2 instance(one that has 1gb of memory).

(1) I download kafka_2.11-0.9.0.0 (2) I run zookeeper bin/zookeeper-server-start.sh config/zookeeper.properties (3) I try running bin/kafka-server-start.sh config/server.properties and I get

Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000c0000000, 1073741824, 0) failed; error='Cannot allocate memory' (errno=12)

.#

.# There is insufficient memory for the Java Runtime Environment to continue.

.# Native memory allocation (mmap) failed to map 1073741824 bytes for committing reserved memory.

.# An error report file with more information is saved as:

.# /home/machine_name/kafka_2.11-0.9.0.0/hs_err_pid9161.log

I checked all propertes in the server.properties config file and in the documentation for properties that could try to do something like this but coudn't find anything.

Does anyone know why is kafka trying to allocated 1 gb when starting?

like image 757
Nautilus Avatar asked Sep 06 '25 03:09

Nautilus


1 Answers

Kafka defaults to the following jvm memory parameters which mean that kafka will allocate 1GB at startup and use a maximum of 1GB of memory:

-Xmx1G -Xms1G

Just set KAFKA_HEAP_OPTS env variable to whatever you want to use instead. You may also just edit ./bin/kafka-server-start.sh and replace the values.

like image 116
Tomasz Jędzierowski Avatar answered Sep 08 '25 21:09

Tomasz Jędzierowski