A simple, fast, and distributed data broker for clustered server use.
The typical problem with distributed servers is encountering the three main issues:
- The server typically has to rely on a central DB server (which adds latency to farther regions)
- A server that does use distributed DBs needs to handle synchronization between the DBs (which is hard to do correctly)
- Database mutations and queries are typically slow and asynchronous operations are difficult to implement correctly
Thus, the solution is to use a broker to extract all the database logic. However, we want a distributed broker so that we are able to limit latency but also have some way to handle synchronization between the brokers.
Net.Server- central server to handle all UDP trafficNet.Manager- central manager to handle all connectionsNet.Conn- connection struct to store connection infoNet.Packet- Protobuf packets to handle all the different packet typesNet.Cluster- functions to connect to other nodes and broadcast updates (via OTP)Net.Reliablity- enforces reliability on all packets as well as handling retriesNet.Security- utilizes AES to encrypt and decrypt incoming packetsNet.Dispatch- performs/stores all packet handlers (based on an ID specified)Prism.Metrics.Reporter- aggregates:telemetryevents into periodic snapshotsclient/ts/loadtest.ts- UDP load generator for quick perf smoke tests
Docs:
docs/performance.mddocs/slos.mddocs/service_api.mddocs/runtime.mddocs/protocol.mddocs/minecraft_practice.md
Prism now supports first-class service modules. Register your services in config:
config :prism, :services, [
Prism.Service.Default,
Prism.Examples.PracticeService,
MyApp.InventoryService
]Example:
defmodule MyApp.InventoryService do
use Prism.Service, name: "inventory", token: "secret-token"
alias Prism.Handler.Context
handle_request(100, :list_items)
def list_items(context) do
Context.json_reply(context, %{items: [%{sku: "abc", qty: 10}]}, message: "ITEMS_OK")
end
endPrism includes a runnable sample service for a Minecraft practice server:
- service:
practice_service - token:
practice_token - docs:
docs/minecraft_practice.md - TS demo:
client/ts/practice-demo.ts
It supports:
- player upsert/profile lookup
- match result recording
- elo/wins/kills/streak leaderboards
- queue-specific ratings
- session/presence updates
- Basic UDP server
- Basic packet handling
- Basic cluster connection
- Finish packet layer
- Add service authentication
- Implemented security via AES encryption
- Add database connection
- Add redis connection
- Add proper regional handling
- Find a way to combat synchronization issues (few will arise because of Cluster implementation)
- Add better logging

