VedarthConfluent commented on PR #14552:
URL: https://github.com/apache/kafka/pull/14552#issuecomment-1855353838

   Hey @mimaison,
   
   Thanks for the input. We will update the KIP based on conclusion of this 
conversation.
   
   Indeed golang is a new language for the repository and it's a relatively 
small piece of logic. But in my opinion given the benefit we are getting from 
using golang, it's worth the maintenance cost of the new language in the repo.
   
   Here are some of our reasons behind the decision to use **golang**:-
   
   - It allows us to have a very lightweight executable that can be used 
without need of golang installed in final docker image.
   - golang code is quite fast in execution time. And this script is being 
called multiple times each time docker container starts, so it's important for 
this piece of code to be efficient to ensure we get good enough startup times.
   - It can be unit tested and thus gives us confidence in the behaviour of the 
code.
   - It is well tested code which is already implemented.
   - Given that it's a very small piece of logic which has a very limited 
usecase, the maintenance cost associated with it is also quite small.
   - We will rarely need to make changes in this logic and when we do, it will 
be supported by unit tests.
   
   Here are some alternatives for the choice of language, along with their pros 
and cons:-
   
   **Java**:-
   - In case of JVM based Docker image using java to write utility script won't 
lead to significant image size difference as we already have JRE available to 
us. Startup time will get impacted though, as java is significantly slower than 
golang and we are calling this script multiple times.
   - For native-image based Docker Image JRE won't be available to us in the 
final image, so we will need to generate a native executable for the utility 
scripts. We may need to generate native configs for it as well.
   - Given that native-image is still experimental, we would like to avoid 
using it in JVM based Docker image for the utility script, as this Docker Image 
can be used for production environment as well.
   - Unit tests can be added easily in java, so we will have confidence in the 
behaviour of the scripts.
   
   **Bash script**:-
   - Unit testing the script won't be possible.
   - Which means debugging and maintaining it will be more challenging.
   
   **Python**:-
   - It will force us to have a python environment to run the utility, 
increasing the final image size.
   - It will be slower than golang or bash.
   - It will be unit testable.
   - Not a good option as the image size impact and startup time impact are not 
worth it.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to