Reactive-Optimized Sentence Detection In Kubernetes Using OpenNLP And Native GraalVM Image With Framework Metric Comparison

Aditya Sharma, Komal Tahiliani, Ghanshyam Prasad Dubey · 2023

Java was chosen over Python for data science endeavours since it is a widely-used programming language. The default JVM was GraalVM, an industry-leading and high-performance JVM, rather than Oracle’s default. GraalVM has several advantages, including native image generation, which pre-compiles Java code into an executable, resulting in a smaller footprint and better performance. Apache OpenNLP, a Java-based natural language processing framework, was utilized for sentence detection. OpenNLP has pre-built models for language recognition, sentence detection, etc. The default OpenNLP code was made completely reactive and functional by modifying it. To achieve the goals, Spring WebFlux was leveraged and the advanced capabilities of Java 17, including lambda and streams. WebFlux, an event-driven asynchronous framework, can provide backpressure-capable, non-blocking clients and servers. Additionally, some of the most widely-used Java frameworks were employed, namely Micronaut, Quarkus, Helidon, and Spring Boot, to develop the code. Two codes were written for each framework: one utilizing traditional Java code and the default OpenNLP sentence detection implementation. At the same time, the other was entirely reactive and functional, with the OpenNLP implementation modified to be reactive and functional. Docker images were created for each and deployed in a Kubernetes environment using Minikube. Finally, concurrent load-testing of the endpoint for 1-1000 users was conducted using an Apache JMeter to assess the performance. Vital metrics such as CPU, memory, docker image size, executable size, executable start-up time, throughput, and error per cent were collected. It was found that reactive-functional programming with Spring Boot resulted in superior scalability, responsiveness, and fault tolerance.

Read the paper · More papers on PaperTik