Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Native-image i.e. GraalVM builds of Zookeeper and CLIs #29

Merged
merged 83 commits into from
Jul 12, 2020
Merged

Conversation

solsson
Copy link
Owner

@solsson solsson commented Apr 24, 2020

Faster startup and less resource consumption matters a lot for things we start often; not so much for actual Kafka brokers. This PR replaces #25.

We're actually running native zookeeper on GKE now in a test cluster. JMX isn't working so logs frequently spit out the below stack trace, but the clusters do work. The experiment lives in Yolean/kubernetes-kafka#311, note the scale-6-9 variant. An exploration of the entrypoints that the Kafka distribution's various ./bin/*.sh wrapper scripts generate is inherent in our work here because with native-image a lot of the options to java processes must be set at compile time. IMO the shell script are a layer of hidden assumptions when running in containers, and because they generate the same startup command every time given the same pod spec this exposure of the actual args allows for better understanding and more clear customizations.

More effort must be spent to make logging work. Ideally with the log4j.properties files that JVM images use, but for now it's quite adequate to chose between slf4j-nop and slf4j-simple (none or info-level logging respectively). The zookeeper build uses slf4j-simple.

[QuorumPeer[myid=9](plain=[0:0:0:0:0:0:0:0]:2181)(secure=disabled)] WARN org.apache.zookeeper.server.ZooKeeperServer - Failed to register with JMX
java.lang.NullPointerException
	at org.apache.zookeeper.jmx.MBeanRegistry.register(MBeanRegistry.java:108)
	at org.apache.zookeeper.server.ServerCnxnFactory.registerConnection(ServerCnxnFactory.java:183)
	at org.apache.zookeeper.server.ZooKeeperServer.finishSessionInit(ZooKeeperServer.java:726)
	at org.apache.zookeeper.server.quorum.Learner.revalidate(Learner.java:630)
	at org.apache.zookeeper.server.quorum.Follower.processPacket(Follower.java:165)
	at org.apache.zookeeper.server.quorum.Follower.followLeader(Follower.java:93)
	at org.apache.zookeeper.server.quorum.QuorumPeer.run(QuorumPeer.java:1253)
	at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:527)
	at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:193)

solsson added 30 commits April 8, 2020 21:49
and nativeagent manually because for now we'll have to craft the native-image Dockerfiles
missing at runtime now. We'll probably get a lot of these when we
run with --allow-incomplete-classpath
in both the entrypoint step and native-image
@solsson
Copy link
Owner Author

solsson commented May 19, 2020

Current status is that 9c702d5 had to be added because of e2695a3. That flag increases the need for testing with real use cases.

Both admin CLIs and Zookeeper log JMX errors. I assume that no native-image user will want JMX, and the errors seem to have no side effects (other than performance?) but look ugly in logs and for zookeeper actually makes the logs difficult to read. We probably need to start writing @Substitute code to get rid of these errors.

@solsson
Copy link
Owner Author

solsson commented Jul 12, 2020

Note that both solsson/kafka:native-cli (including images for individual admin commands) and solsson/kafka:native-zookeeper-server-start use hard coded logging settings, i.e. log4j.properties has no effect. The issue with configured logging is that reflection-config.json probably needs to be tailored to different log4j configurations because they depend on different classes.

The resulting builds from this PR are solsson/kafka:native-cli@sha256:fbf29c59182fb87921c5199783d2d5796856ecbfe34a9c03eca658b3cf50f3c4 and solsson/kafka:native-zookeeper-server-start@sha256:ba3a0632240b8906a3b5bb6441e98ad9d9de73cb716b156ca68f1b435c819e8b.

@solsson solsson merged commit 84d9453 into master Jul 12, 2020
solsson added a commit to Yolean/kubernetes-kafka that referenced this pull request Jul 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant