How do I set the Java options for Kafka?

后端 未结 6 1690
轮回少年
轮回少年 2020-12-13 06:12

I\'ve been experimenting with Kafka and saw from the documentation on the main site that you\'re able to set different options for the jvm like heap size and the garbage col

6条回答
  •  悲哀的现实
    2020-12-13 06:54

    You can pass java parameters from command line . E.g.

    java -server -Xms3072m -Xmx3072m -XX:NewSize=256m -XX:MaxNewSize=256m  -classpath  foo.class
    

    For a `production server config you can create a properties file or set them in Code by creating

     Properties props = new Properties();
     props.put("serializer.class", "kafka.serializer.StringEncoder");
    

    And then supply them to producerConfig

    ProducerConfig config = new ProducerConfig(props);
    

提交回复
热议问题