Skip to content

Open-NET-Libraries/Open.Orleans

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Open.Orleans - Distributed Real-Time Chat System

A production-grade demonstration of Microsoft Orleans + SignalR + Blazor WASM for building scalable, real-time chat applications with immutable event sourcing.

🎯 Project Goals

  • Educational Reference: Canonical example of Orleans + SignalR integration
  • Production Patterns: Clean architecture, testability, observability
  • Minimal Overhead: Responsive real-time UX on modest hardware
  • Horizontal Scaling: Multi-silo Orleans cluster with zero message loss
  • Immutable Events: All operations as auditable, replayable events

🏗️ Architecture

Blazor Client (WASM)
│
├─► REST API (Message History)
│
└─► SignalR (Live Events)
    │
    ▼
Orleans Cluster (3 Silos)
│
├─► UserGrain (Presence & Connections)
├─► RoomGrain (Membership & Routing) 
├─► MessageGrain (Message Lifecycle)
└─► StreamManagerGrain (Event Broadcasting)
    │
    ▼
File/JSON Storage (Event Logs)

🚀 Quick Start

Prerequisites

  • .NET 8.0 SDK
  • Visual Studio 2022 or VS Code

Running Locally

# Clone the repository
git clone https://github.com/Open-NET-Libraries/Open.Orleans.git
cd Open.Orleans

# Start Orleans cluster (3 silos)
dotnet run --project src/Open.Orleans.Silo

# Start SignalR server
dotnet run --project src/Open.Orleans.Server

# Launch Blazor client
dotnet run --project src/Open.Orleans.Client.Blazor

Navigate to https://localhost:7001 to access the chat interface.

📁 Project Structure

├── src/
│   ├── libraries/                          # Reusable Orleans libraries
│   │   ├── Open.Orleans.Core/              # Core abstractions & utilities
│   │   ├── Open.Orleans.Persistence.File/ # File-based persistence provider
│   │   └── Open.Orleans.SignalR/          # SignalR integration library
│   └── demos/
│       └── liveforum/                      # Real-time chat demo
│           ├── Open.Orleans.LiveForum.Contracts/  # Shared interfaces & DTOs
│           ├── Open.Orleans.LiveForum.Grains/     # Orleans grain implementations
│           ├── Open.Orleans.LiveForum.Silo/       # Orleans hosting & configuration
│           ├── Open.Orleans.LiveForum.Server/     # SignalR hubs & REST API
│           └── Open.Orleans.LiveForum.Client/     # Blazor WASM client
├── test/
│   ├── Open.Orleans.Tests.Unit/                   # Library unit tests
│   └── Open.Orleans.LiveForum.Tests.Integration/  # Demo integration tests
├── docs/
│   ├── spec.md                     # Architecture specification
│   ├── benchmarks/                 # Performance test results
│   └── deployment/                 # Production deployment guides
└── scripts/
    ├── start-cluster.ps1           # Multi-silo startup script
    └── load-test.ps1              # Performance testing

🎭 Key Features

✨ Real-Time Messaging

  • Sub-100ms message delivery (local cluster)
  • Live typing indicators and presence
  • Multi-device connection support
  • Automatic reconnection handling

📚 Message Management

  • Immutable event sourcing for all operations
  • Message editing with full history
  • Soft delete with audit trail preservation
  • Infinite scroll with REST-based pagination

🏢 Enterprise Ready

  • Multi-silo horizontal scaling
  • Structured logging with correlation IDs
  • Metrics and observability endpoints
  • Graceful failure recovery

🧪 Testing & Quality

  • Comprehensive unit test coverage
  • Integration tests for multi-silo scenarios
  • Load testing with 1000+ concurrent users
  • Automated CI/CD pipeline

📊 Performance Benchmarks

Metric Local (3 Silos) Cloud (3 Nodes)
Message Latency (p95) < 100ms < 200ms
Concurrent Users 1,000+ 5,000+
Memory per Silo < 1GB < 2GB
CPU Utilization < 30% < 50%

Benchmarks available in /docs/benchmarks/

🔧 Configuration

Orleans Clustering

{
  "Orleans": {
    "ClusterId": "open-orleans-dev",
    "ServiceId": "chat-service",
    "Persistence": {
      "Provider": "File",
      "Path": "./storage"
    }
  }
}

SignalR Options

{
  "SignalR": {
    "MaxConnectionCount": 10000,
    "KeepAliveInterval": "00:00:15",
    "ClientTimeoutInterval": "00:01:00"
  }
}

🤝 Contributing

We welcome contributions! Please see our Contributing Guidelines.

Development Workflow

  1. Fork the repository
  2. Create a feature branch
  3. Write tests for new functionality
  4. Ensure all tests pass
  5. Submit a pull request

📝 Documentation

📄 License

This project is licensed under the MIT License.

🙏 Acknowledgments

Built with:


Star this repository if you find it helpful for learning Orleans and SignalR!

💬 Questions? Open an issue or start a discussion.

🚀 Want to contribute? Check out our good first issues.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published