Skip to content

skrjanec/example-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

## Requirements

In order to run this example you will need the following:

1. Java 8 (or newer), you can use any implementation:
    * If you have installed Java, you can check the version by typing the following in a command line:
        
        ```
        java -version
        ```

2. Maven 3.2.1 (or newer):
    * If you have installed Maven, you can check the version by typing the following in a command line:
        
        ```
        mvn -version
        ```
3. Git:
    * If you have installed Git, you can check the version by typing the following in a command line:
    
        ```
        git --version
        ```
    

## Prerequisites

This sample does not contain any prerequisites and can be started on its own.

## Usage

The example uses maven to build and run the microservice.

1. Build the sample using maven:

    ```bash
    $ cd jax-rs
    $ mvn clean package
    ```

2. Run the application:
* Exploded:

    ```bash
    $ java -cp target/classes:target/dependency/* com.kumuluz.ee.EeApplication
    ```
    
    in Windows environment use the command
    ```batch
    java -cp target/classes;target/dependency/* com.kumuluz.ee.EeApplication
    ```
    
The application/service can be accessed on the following URL:
* JAX-RS REST resource - http://localhost:8080/v1

To shut down the example simply stop the processes in the foreground.

3. Testing the application with enclosed postman collection

Import the enclosed postman collection in the root of the project example-rs.postman_collection.json.

## Answers
How to speed up writing to DB?

1. Do it in parallel and async for each event. Data acquisition, sorting and
write. Via queue or some other mechanism.

2. If this data is coming in as a stream. Shouldn't the events already be
sorted? Maybe not in every case, but in general. What is the maximum amount
of time an event is expected to arrive? This can help us in setting the wait
time until events are sorted and written to db.

3. Batch insert (implemented)

4. Combination of all 3. Batch insert per event in parallel based on maximum
amount of time.
 
MIN, MAX, date of insert
"2024-05-29 01:31:24.325"
"2024-05-29 01:32:07.811"

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages