Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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)