Understanding Container Deployments
Before diving into specific deployment strategies, let’s understand why container-based deployments have become the standard for modern applications.What are Containers?
Containers are lightweight, standalone packages that include everything needed to run an application:- Application code and runtime
- System tools and libraries
- Configuration settings
- Dependencies
Benefits of Containerization for Decision and Process Services
Containerization provides several key advantages for Aletyx Enterprise Build of Kogito and Drools services:- Consistency across environments: The same container image runs identically in development, testing, staging, and production
- Rapid startup and recovery: Containers typically start in seconds, enabling quick scaling and recovery
- Microservice architecture support: Natural fit for breaking down monolithic process applications
- Resource efficiency: Precise control over CPU, memory, and storage allocation
- Scalability: Easy horizontal and vertical scaling
Why Containerize Process and Decision Services?
Containerizing Aletyx Enterprise Build of Kogito and Drools services delivers specific benefits:- Modular deployment: Break free from monolithic process engines
- Independent scaling: Scale specific process instances or decision services as needed
- Environment-specific variants: Deploy different process variants to different environments
- A/B testing: Test different decision rule versions in production
- Isolation: Keep long-running processes separate from short-lived decisions
Deployment Strategies: JVM vs Native Image
Aletyx Enterprise Build of Kogito and Drools services can be deployed in two primary ways: as traditional JVM applications or as Native Images compiled with GraalVM.JVM Deployment
The traditional approach runs your Kogito service on the Java Virtual Machine:Native Image Deployment
The GraalVM Native Image approach compiles your application to a standalone executable:Key Differences
When to Choose JVM Deployment
JVM deployment is ideal for:- Long-running services: Services that remain active for extended periods benefit from JVM’s Just-In-Time (JIT) optimization
- Complex rule evaluation: Decision services with complex rule sets that benefit from runtime optimization
- Large working memory: Applications needing significant working memory for rule evaluation
- Faster build times: Development environments where rapid iteration is critical
- Dynamic class loading: Services that need to load classes dynamically at runtime
When to Choose Native Image
Native Image deployment excels for:- On-demand services: Decision services called infrequently with cold start times under 100ms
- Event-driven orchestrators: Process services that scale to zero between events
- Serverless environments: Functions that need to start quickly and efficiently
- Resource-constrained environments: Edge computing or IoT devices with limited resources
- Microservice architectures: Where many small services run independently
- CLI tools: Process-enabled command-line tools with minimal footprint
Practical Example: Decision Service Deployment
Let’s walk through how to set up a simple decision service for both JVM and Native Image deployment.Prerequisites
- Java 17 or later
- Maven 3.9.0 or later
- Docker or Podman
- GraalVM Community Edition 22.3 or later (for Native Image)
- Aletyx Enterprise Build of Kogito and Drools version 10.1.0-aletyx
Creating a Decision Service Project
First, let’s create a simple decision service project using the ake Quarkus archetype:Project Structure
The generated project includes:Building for JVM Deployment
To build your decision service for JVM deployment:Building for Native Image
To build your decision service as a Native Image:Deployment Configuration
For both deployment types, you’ll need to configure environment variables appropriately. Here’s an exampledeployment.yaml for Kubernetes:
JVM Deployment Configuration
Native Image Deployment Configuration
Performance Comparison
Let’s compare the performance characteristics of both deployment strategies:Startup Time
Memory Footprint
Request Latency
Best Practices for Quarkus Kogito Deployments
Regardless of which deployment strategy you choose, follow these best practices:Configuration Management
- Externalize environment-specific variables:
- Leverage Quarkus profiles:
- Follow the Twelve-Factor App methodology for configuration, especially for secrets
Secrets vs ConfigMaps
Use Kubernetes resources appropriately:Scaling Considerations
How to scale your decision and process services:Horizontal Scaling (More Containers)
For Aletyx Enterprise Build of Kogito and Drools version 10.1.0-aletyx, full horizontal scaling is supported for:- Decision Services (DRL and DMN)
- Stateless BPMN processes
Vertical Scaling (More CPU/RAM per pod)
Consider these factors when scaling decision services vertically:- Rule complexity: More complex rules require more CPU
- Decision table size: Large tables need more memory
- Concurrent evaluations: Higher concurrency demands more resources
- Memory for rule cache: JVM deployment benefits from larger cache
Using CI/CD Pipelines
Integrate both JVM and Native Image builds into your CI/CD pipelines:Common Pitfalls and How to Avoid Them
Real-World Examples
Case Study: On-Demand Credit Decision Service
Challenge: A financial institution needed to process credit decisions through an API that was called infrequently but required rapid response times. Solution: Deployed as a Native Image service in a serverless environment. Results:- Cold start time reduced from 3.5 seconds to 120ms
- Memory usage decreased by 78%
- Able to scale to zero between requests, reducing costs by 65%
Case Study: Insurance Claims Processing
Challenge: An insurance company needed to process claims through a complex workflow with multiple decision points and integrations. Solution: Deployed as a JVM service with horizontal scaling. Results:- Sustained throughput of 200 claims per second after JIT warm-up
- 99.99% uptime with no degradation over time
- Successfully handled peak loads by scaling horizontally
Conclusion
Choosing between JVM and Native Image deployment for your Aletyx Enterprise Build of Kogito and Drools services depends on your specific use case, performance requirements, and operational constraints:- Use JVM deployment for long-running, complex services that benefit from JIT optimization
- Use Native Image deployment for on-demand, event-driven services that need fast startup and lower resource consumption