-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
80 lines (54 loc) · 2.13 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
## 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"