Skip to content

Commit 2fe4d8f

Browse files
authored
Merge pull request #3 from BinaryIgor/shards
Shards
2 parents 81554e6 + 67c8ff2 commit 2fe4d8f

67 files changed

Lines changed: 1751 additions & 1334 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -80,17 +80,3 @@ WHERE topic = :topic AND name = :c_name AND partition = 0;
8080
Limitation being that if consumer is partitioned, it must have the exact same number of partition as in the topic
8181
definition.
8282
It's a rather acceptable tradeoff and easy to enforce at the library level.
83-
84-
## TODO
85-
86-
* performance benchmarks and more examples
87-
* usage examples
88-
* built-in outbox
89-
* expiring events/TTL?
90-
* compact topics - unique key
91-
* join, aka streams
92-
* increase code coverage
93-
* JavaDocs
94-
* Support schemas init in registry - why require schemas from users, if it is always the same?
95-
* Sharded version for endless scalability
96-

TODO.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
* performance benchmarks on infra & scripts to reproduce them
2+
* usage examples
3+
* just pub/sub
4+
* giving access to event tables as a means of a simple export - since they are all there
5+
* expiring events/TTL?
6+
* compact topics - unique key
7+
* join, aka streams
8+
* more elaborate definitions change support
9+
* JavaDocs
10+
* Support schemas init in registry - why require schemas from users, if it is always the same?

benchmarks/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
# Benchmarks
22

3-
Various benchmarks to show performance limits of EventSQL.
3+
Various benchmarks to show performance of EventSQL.
44

55
## Queries
66
```
77
select id, convert_from(value, 'UTF8')::json from account_created_event limit 10;
88
create index account_created_event_email
99
on account_created_event ((encode(value, 'escape')::json->>'email'));
1010
```
11+
12+
## TODO
13+
* sharding version tests -> endpoint to see when it's ready

benchmarks/app-db/Dockerfile

Lines changed: 0 additions & 2 deletions
This file was deleted.

benchmarks/app-db/build_and_run.bash

Lines changed: 0 additions & 14 deletions
This file was deleted.

benchmarks/app-db/init_db.sql

Lines changed: 0 additions & 4 deletions
This file was deleted.

benchmarks/app/pom.xml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,10 @@
3636
<groupId>org.springframework.boot</groupId>
3737
<artifactId>spring-boot-starter-web</artifactId>
3838
</dependency>
39-
4039
<dependency>
41-
<groupId>org.springframework.boot</groupId>
42-
<artifactId>spring-boot-starter-jdbc</artifactId>
40+
<groupId>com.zaxxer</groupId>
41+
<artifactId>HikariCP</artifactId>
4342
</dependency>
44-
4543
<dependency>
4644
<groupId>org.springdoc</groupId>
4745
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>

benchmarks/app/src/main/java/com/binaryigor/eventsql/benchmarks/AccountCreatedHandler.java

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,34 @@
55
import org.springframework.stereotype.Component;
66

77
import java.util.Collection;
8+
import java.util.Random;
89

910
@Component
1011
public class AccountCreatedHandler {
1112

12-
private final AccountCreatedRepository accountCreatedRepository;
13+
private static final Random RANDOM = new Random();
1314
private final Counter accountsHandledCounter;
1415

15-
public AccountCreatedHandler(AccountCreatedRepository accountCreatedRepository,
16-
MeterRegistry meterRegistry) {
17-
this.accountCreatedRepository = accountCreatedRepository;
16+
public AccountCreatedHandler(MeterRegistry meterRegistry) {
1817
this.accountsHandledCounter = Counter.builder("accounts_handled_total")
1918
.register(meterRegistry);
2019
}
2120

2221
public void handle(AccountCreated accountCreated) {
23-
accountCreatedRepository.save(accountCreated);
22+
handleDelay();
2423
accountsHandledCounter.increment();
2524
}
2625

2726
public void handle(Collection<AccountCreated> accountsCreated) {
28-
accountCreatedRepository.save(accountsCreated);
27+
handleDelay();
2928
accountsHandledCounter.increment(accountsCreated.size());
3029
}
3130

32-
public int accountsHandledCount() {
33-
return (int) accountsHandledCounter.count();
31+
private void handleDelay() {
32+
try {
33+
Thread.sleep(1 + RANDOM.nextInt(100));
34+
} catch (Exception e) {
35+
throw new RuntimeException(e);
36+
}
3437
}
3538
}

benchmarks/app/src/main/java/com/binaryigor/eventsql/benchmarks/AccountCreatedRepository.java

Lines changed: 0 additions & 53 deletions
This file was deleted.

benchmarks/app/src/main/java/com/binaryigor/eventsql/benchmarks/Benchmarks.java

Lines changed: 0 additions & 125 deletions
This file was deleted.

0 commit comments

Comments
 (0)