Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/scarletredman/roompicker
Simple matchmaking system
https://github.com/scarletredman/roompicker
matchmaking matchmaking-server rest-api spring vaadin
Last synced: 7 days ago
JSON representation
Simple matchmaking system
- Host: GitHub
- URL: https://github.com/scarletredman/roompicker
- Owner: ScarletRedMan
- License: gpl-3.0
- Created: 2023-11-13T00:55:54.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2024-05-13T10:49:30.000Z (6 months ago)
- Last Synced: 2024-05-14T09:36:10.581Z (6 months ago)
- Topics: matchmaking, matchmaking-server, rest-api, spring, vaadin
- Language: Java
- Homepage: https://trello.com/b/7iO7yfs1/roompicker
- Size: 1.02 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
RoomPicker
======Simple matchmaking system and load balancer.
Features:
- Simple to use. Everything works out of the box.
- 3 picking methods (Sequential filling, Round Robin, Least picked).
- Optional control panel.
- Collecting metrics using Prometheus integration ([ready Grafana dashboard](./RoomPicker-Grafana-Dashboard.json)).**This project is under development. Do not use in production!**
How to use
----------First you need start `RoomPicker Server` and then you can start `RoomPicker Control Panel` (if you need).
After that, you can connect to the server using `RoomPicker Client`.Example of using the RoomPicker Client
----------Create a Node and a Room, after that, system pick up a room for 5 entities.
```java
class Example {
public static void main(String[] args) {
var client = new RoomPickerClient(
"http://dragonestia.ru:8080",
"admin",
"qwerty123"
);// Creating instance
var nodeId = NodeIdentifier.of("test-instance");
var nodeDefinition = new NodeDefinition(nodeId)
.setPickingMethod(PickingMethod.LEAST_PICKED);
client.getNodeRepository().saveNode(nodeDefinition);// Creating room
var roomId = RoomIdentifier.of("test-room");
var roomDefinition = new RoomDefinition(nodeId, roomId)
.setMaxSlots(10)
.setPayload("Hello world!");
client.getRoomRepository().saveRoom(roomDefinition);// Picking room for 5 entities
var entities = new HashSet();
for (int i = 0 ; i < 5; i++) {
var entity = UserIdentifier.of("test-entity-" + i);
entities.add(entity);
}
try {
var response = client.getNodeRepository().pickRoom(nodeId, entities);
// TODO...
} catch (NoRoomsAvailableException ex) {
// Cannot pick room
}
}
}
```Stress testing
----------If you want to stress test the server, you can run the script from the `noiser` module.
Before starting stress testing, you'd better run Prometheus and Grafana from `docker-compose.yml`.
In Grafana, you can see this view:
![Grafana](.github/img/grafana.png)