Skip to main content

RLDec is a decomposition tool that analyzes the source code of a monolithic Java application and suggests the recommended microservices for each class in the system using a Deep Reinforcement Learning based method.

Project description

RLDec

This project is an implementation of the RLDec decomposition approach as described in the paper "Extracting Microservices from Monolithic Systems using Deep Reinforcement Learning" (2024).

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Advanced usage
  5. Roadmap
  6. Authors
  7. Version History
  8. Artifacts Package
  9. License
  10. References

About The Project

This project is an implementation of the RLDec decomposition approach as described in the paper "Extracting Microservices from Monolithic Systems using Deep Reinforcement Learning" [1].

RLDec is a decomposition tool that analyzes the source code of a monolithic Java application and suggests the recommended microservices for each class in the system using a Deep Reinforcement Learning based method.

The RLDec implementation contains the logic for generating the decomposition of the monolithic application. However, the analysis of the source code has to be done by another tool. This implementation is compatible with the packages decomp-java-analysis-service and decomp-parsing-service that handle the static analysis part of the process. Otherwise, it is possible to use your own tool but the input to RLDec has to conform to the required types and structure.

Getting Started

Prerequisites

The main requirements are:

  • Python 3.10 or higher

Installation

  1. Clone the repo
    git clone https://github.com/khaledsellami/decomp-rldec.git
    
  2. Install rldec as a Python module:
    cd decomp-rldec/
    pip install -e .
    
    Or you can install only the required libraries:
     pip install -r requirements.txt
    

Usage

Preparing the input data

In order to use RLDec, the source code of the monolithic application has to be analyzed and parsed to extract the structural and semantic dependencies as described in the paper. You can use our anaysis and parsing tools or use your own tools to generate the required data:

Using the analysis and parsing tools:

The details of how to use these tools and generate the analysis results with them can be found in their corresponding repositories: decomp-java-analysis-service and decomp-parsing-service.

Using a third-party analysis tool:

The folder that contains the static analysis results must contain the following strcuture:

   path_to_my_data/
   └── name_of_the_app/
      ├── class_word_count.parquet: a NxM matrix representing the Bag-of-Word vectors of each class where N is the number of classes and M is the size of the vocabulary
      └── class_interactions.parquet: a NxM matrix representing the dependencies from each class to the others (calls, inheritance, field usage, etc) where N is the number of classes 

Training the model

The training of the model can be done using the following command (example with the combsequential method):

   python main.py train your_app_name --data /path/to/data --output /path/to/save/model --config /path/to/config --approach combsequential --model model_name

The configuration file contains the hyperparameters of the approach. Examples of default configurations can be found in the default_configs folder.

You can also use the following command to get more details about the training:

   python main.py train --help

Decomposing the monolithic application using the trained model

The decomposition of the monolithic application can be done using the following command:

   python main.py decompose your_app_name --model model_name --output /path/to/save/decomposition --path /path/to/saved/model

The output will be a JSON file that contains the decomposition of the monolithic application in addition to some metadata.

Advanced usage

Using the analysis and parsing tools as gRPC services

The analysis and parsing tools can be used as gRPC services. In this case, you do not need to prepare the data for RLDec. You can use the following command to train the model:

   python main.py train your_app_name --output /path/to/output --repo /path/or/github/link/to/source/code

Using RLDec as a gRPC server

RLDec can be used as a gRPC server and its API can be consumed to train and generate the decompositions. You can start the server using the following command:

   python main.py start

For more details about the API, you can inspect the protobuf file "rldec.proto" in the proto/rldec folder.

Using RLDec as a Python module

RLDec can be used as a Python module and customized to fit your needs. For examples to how to use the module, you can inspect the files in the jobs folder.

Roadmap

  • Improve the documentation of this module
  • Integrate the CombFlattened approach into the CLI and Server
  • Add an option to use the parsing service as a Python module
  • Update the default configurations to include the new approaches paths

Authors

Khaled Sellami - khaledsellami - khaled.sellami.1@ulaval.ca

Version History

  • 0.5.2
    • Initial Public Release

Artifacts Package

This project only contains the source code of the RLDec implementation. For reproducing the results of the paper, you can refer to the Artifacts Package in Figshare or its Github repository.

License

This project is licensed under the Apache 2.0 License - see the LICENSE file for details.

References

[1] TODO add the reference to the paper when published

(back to top)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rldec-0.5.2.tar.gz (41.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rldec-0.5.2-py3-none-any.whl (55.7 kB view details)

Uploaded Python 3

File details

Details for the file rldec-0.5.2.tar.gz.

File metadata

  • Download URL: rldec-0.5.2.tar.gz
  • Upload date:
  • Size: 41.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.14

File hashes

Hashes for rldec-0.5.2.tar.gz
Algorithm Hash digest
SHA256 3fb58ac74d991d990a865667b49a15e5419bb7e1ea94c6e3e7f06f43048da246
MD5 109a63f1a54aa2d31b2fe1f828f54650
BLAKE2b-256 ec6b3b8afacd1d531d936cf680bf4e20802d246de0d0bf21f0602e9fc82eae0d

See more details on using hashes here.

File details

Details for the file rldec-0.5.2-py3-none-any.whl.

File metadata

  • Download URL: rldec-0.5.2-py3-none-any.whl
  • Upload date:
  • Size: 55.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.14

File hashes

Hashes for rldec-0.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 10d37988f76841047bc24b2a6a98f90ad8f0316c00dd5c3a79da50905bbc5aec
MD5 239769a8837b337b44f1b0d633f78609
BLAKE2b-256 f0529074fc79a18182e2950dda4973283b03a0cc27d0b041809d12334fe29d12

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page