Skip to content

krzsam/scala-openliberty-mandelbrot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

scala-openliberty-mandelbrot

An example application to calculate a Mandelbrot Set using Microprofile/Open Liberty microservices implemented in Scala. The goal is to demonstrate technical possibility of using OpenLiberty with Scala and possibility of deploying such solution as Kubernetes services. The solution is not intended to be optimal in terms of choice of technologies or performance. Some places are left unoptimised in terms of performance for the benefit of clarity of presentation.

Application Architecture

The application is divided logically into two microservices, which share the same codebase for the purpose of ease of the implementation.

  • Calculation Service - implemented by IterationService class, this service executes the actual formula iteration calculation for each data point received Service parameters:
    • posx, posy - coordinates of datapoint within image space
    • datax, datay - coordinates of the datapoint within data space
    • iterations - maximum number of iterations each datapoint should be iterated through
  • Image Generation Service - implemented by ImageService class, this service maps image space onto data space as specified by query parameters, and then for each datapoint, invokes Calculation Service to run the iteration formula. Service parameters:
    • tlx, tly - coordinates of 'top-left' corner of the data space
    • brx, bry - coordinates of 'bottom-right' corner of the data space
    • sx, sy - dimensions of the image to be generated
    • iterations - maximum number of iterations each datapoint should be iterated through

Open Liberty configuration

  • /config directory - The contents of this directory are result of reverse-engineering of contents of the resulting Docker image as created by an example project GitHub: OpenLiberty/guide-getting-started
    • /config/apps - placeholder directory where the resulting WAR file will be placed in Docker image
    • /config/dropins - placeholder directory
    • /config/workarea - placeholder directory
    • /config/bootstrap.properties - property file with values used by server.xml file
    • /config/server.env - file generated by the above GitHub project
    • /config/server.xml - main Open Liberty server configuration file
  • /opt/ol/wlp/output/defaultServer/resources/security/ - the below two files were copied from a running container (using docker cp) and placed in the respective target folder to reduce server startup time. These files, if not provided already, were generated anew each time a container was started up.
    • key.p12
    • ltpa.keys

Kubernetes configuration

  • /src/main/k8s - contains YAML files to create Kubernetes deployments and services
    • Important - for Image Generation Service to be able to correctly invoke Calculation Service, the name of the host defined in ImageService class needs to match exactly what is set as a service name for Calculation Service as defined in calculation-service.yaml. For more information on how DNS works with pods and services you can read Kubernetes: DNS for Services and Pods

Image

Links

Infrastructure

  • Amazon Web Services (AWS)
    • 3 nodes : t2.small , OS: Debian Stretch 9.11
  • Open Liberty version 19.0.0.10
  • Docker version 19.03.2
  • Kubernetes version v1.15.0

Releases

No releases published

Packages

No packages published