Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
Encore | 4,147 | 3 | 2 days ago | 21 | December 05, 2023 | 46 | mpl-2.0 | Go | ||
Encore is the end-to-end Backend Development Platform that lets you escape cloud complexity. | ||||||||||
Foundatio | 1,813 | 38 | 62 | a month ago | 460 | June 23, 2023 | 29 | apache-2.0 | C# | |
Pluggable foundation blocks for building distributed apps. | ||||||||||
Rpc Websockets | 531 | 104 | 116 | 17 days ago | 116 | November 22, 2023 | 10 | other | JavaScript | |
JSON-RPC 2.0 implementation over WebSockets for Node.js and JavaScript/TypeScript | ||||||||||
Gauntlet | 437 | 13 days ago | mit | |||||||
🔖 Guides, Articles, Podcasts, Videos and Notes to Build Reliable Large-Scale Distributed Systems. | ||||||||||
Adaptdl | 339 | 3 | a year ago | 12 | April 20, 2022 | 23 | apache-2.0 | Python | ||
Resource-adaptive cluster scheduler for deep learning training. | ||||||||||
Etcd Cloud Operator | 224 | 3 months ago | 12 | apache-2.0 | Go | |||||
Deploying and managing production-grade etcd clusters on cloud providers: failure recovery, disaster recovery, backups and resizing. | ||||||||||
Eventual | 156 | 16 days ago | 104 | mit | TypeScript | |||||
Build scalable and durable micro-services with APIs, Messaging and Workflows | ||||||||||
Autodist | 92 | 3 years ago | 2 | July 16, 2020 | 20 | apache-2.0 | Python | |||
Simple Distributed Deep Learning on TensorFlow | ||||||||||
Distributed_rl | 66 | a year ago | 1 | mit | Python | |||||
Pytorch implementation of distributed deep reinforcement learning | ||||||||||
Awesome Scalability Toolbox | 62 | 3 months ago | ||||||||
My opinionated list of products and tools used for high-scalability projects |
Pluggable foundation blocks for building loosely coupled distributed apps.
Includes implementations in Redis, Azure, AWS, RabbitMQ, Kafka and in memory (for development).
When building several big cloud applications we found a lack of great solutions (that's not to say there isn't solutions out there) for many key pieces to building scalable distributed applications while keeping the development experience simple. Here are a few examples of why we built and use Foundatio:
To summarize, if you want pain free development and testing while allowing your app to scale, use Foundatio!
Foundatio can be installed via the NuGet package manager. If you need help, please open an issue or join our Discord chat room. Were always here to help if you have any questions!
This section is for development purposes only! If you are trying to use the Foundatio libraries, please get them from NuGet.
Foundatio.sln
Visual Studio solution file.The sections below contain a small subset of what's possible with Foundatio. We recommend taking a peek at the source code for more information. Please let us know if you have any questions or need assistance!
Caching allows you to store and access data lightning fast, saving you exspensive operations to create or get data. We provide four different cache implementations that derive from the ICacheClient
interface:
MaxItems
property. We use this in Exceptionless to only keep the last 250 resolved geoip results.ICacheClient
and the InMemoryCacheClient
and uses an IMessageBus
to keep the cache in sync across processes. This can lead to huge wins in performance as you are saving a serialization operation and a call to the remote cache if the item exists in the local cache.HybridCacheClient
that uses the RedisCacheClient
as ICacheClient
and the RedisMessageBus
as IMessageBus
.ICacheClient
and a string scope
. The scope is prefixed onto every cache key. This makes it really easy to scope all cache keys and remove them with ease.using Foundatio.Caching;
ICacheClient cache = new InMemoryCacheClient();
await cache.SetAsync("test", 1);
var value = await cache.GetAsync<int>("test");
Queues offer First In, First Out (FIFO) message delivery. We provide four different queue implementations that derive from the IQueue
interface:
using Foundatio.Queues;
IQueue<SimpleWorkItem> queue = new InMemoryQueue<SimpleWorkItem>();
await queue.EnqueueAsync(new SimpleWorkItem {
Data = "Hello"
});
var workItem = await queue.DequeueAsync();
Locks ensure a resource is only accessed by one consumer at any given time. We provide two different locking implementations that derive from the ILockProvider
interface:
ILockProvider
and a string scope
. The scope is prefixed onto every lock key. This makes it really easy to scope all locks and release them with ease.It's worth noting that all lock providers take a ICacheClient
. This allows you to ensure your code locks properly across machines.
using Foundatio.Lock;
ILockProvider locker = new CacheLockProvider(new InMemoryCacheClient(), new InMemoryMessageBus());
var testLock = await locker.AcquireAsync("test");
// ...
await testLock.ReleaseAsync();
ILockProvider throttledLocker = new ThrottlingLockProvider(new InMemoryCacheClient(), 1, TimeSpan.FromMinutes(1));
var throttledLock = await throttledLocker.AcquireAsync("test");
// ...
await throttledLock.ReleaseAsync();
Allows you to publish and subscribe to messages flowing through your application. We provide four different message bus implementations that derive from the IMessageBus
interface:
using Foundatio.Messaging;
IMessageBus messageBus = new InMemoryMessageBus();
await messageBus.SubscribeAsync<SimpleMessageA>(msg => {
// Got message
});
await messageBus.PublishAsync(new SimpleMessageA { Data = "Hello" });
Allows you to run a long running process (in process or out of process) without worrying about it being terminated prematurely. We provide three different ways of defining a job, based on your use case:
IJob
interface. We also have a JobBase
base class you can derive from which provides a JobContext and logging. You can then run jobs by calling RunAsync()
on the job or by creating a instance of the JobRunner
class and calling one of the Run methods. The JobRunner can be used to easily run your jobs as Azure Web Jobs.using Foundatio.Jobs;
public class HelloWorldJob : JobBase {
public int RunCount { get; set; }
protected override Task<JobResult> RunInternalAsync(JobContext context) {
RunCount++;
return Task.FromResult(JobResult.Success);
}
}
var job = new HelloWorldJob();
await job.RunAsync(); // job.RunCount = 1;
await job.RunContinuousAsync(iterationLimit: 2); // job.RunCount = 3;
await job.RunContinuousAsync(cancellationToken: new CancellationTokenSource(10).Token); // job.RunCount > 10;
QueueJobBase<T>
class. You can then run jobs by calling RunAsync()
on the job or passing it to the JobRunner
class. The JobRunner can be used to easily run your jobs as Azure Web Jobs.using Foundatio.Jobs;
public class HelloWorldQueueJob : QueueJobBase<HelloWorldQueueItem> {
public int RunCount { get; set; }
public HelloWorldQueueJob(IQueue<HelloWorldQueueItem> queue) : base(queue) {}
protected override Task<JobResult> ProcessQueueEntryAsync(QueueEntryContext<HelloWorldQueueItem> context) {
RunCount++;
return Task.FromResult(JobResult.Success);
}
}
public class HelloWorldQueueItem {
public string Message { get; set; }
}
// Register the queue for HelloWorldQueueItem.
container.AddSingleton<IQueue<HelloWorldQueueItem>>(s => new InMemoryQueue<HelloWorldQueueItem>());
// To trigger the job we need to queue the HelloWorldWorkItem message.
// This assumes that we injected an instance of IQueue<HelloWorldWorkItem> queue
IJob job = new HelloWorldQueueJob();
await job.RunAsync(); // job.RunCount = 0; The RunCount wasn't incremented because we didn't enqueue any data.
await queue.EnqueueAsync(new HelloWorldWorkItem { Message = "Hello World" });
await job.RunAsync(); // job.RunCount = 1;
await queue.EnqueueAsync(new HelloWorldWorkItem { Message = "Hello World" });
await queue.EnqueueAsync(new HelloWorldWorkItem { Message = "Hello World" });
await job.RunUntilEmptyAsync(); // job.RunCount = 3;
message bus
. The job must derive from the WorkItemHandlerBase
class. You can then run all shared jobs via JobRunner
class. The JobRunner can be used to easily run your jobs as Azure Web Jobs.using System.Threading.Tasks;
using Foundatio.Jobs;
public class HelloWorldWorkItemHandler : WorkItemHandlerBase {
public override async Task HandleItemAsync(WorkItemContext ctx) {
var workItem = ctx.GetData<HelloWorldWorkItem>();
// We can report the progress over the message bus easily.
// To receive these messages just inject IMessageSubscriber
// and Subscribe to messages of type WorkItemStatus
await ctx.ReportProgressAsync(0, "Starting Hello World Job");
await Task.Delay(TimeSpan.FromSeconds(2.5));
await ctx.ReportProgressAsync(50, "Reading value");
await Task.Delay(TimeSpan.FromSeconds(.5));
await ctx.ReportProgressAsync(70, "Reading value");
await Task.Delay(TimeSpan.FromSeconds(.5));
await ctx.ReportProgressAsync(90, "Reading value.");
await Task.Delay(TimeSpan.FromSeconds(.5));
await ctx.ReportProgressAsync(100, workItem.Message);
}
}
public class HelloWorldWorkItem {
public string Message { get; set; }
}
// Register the shared job.
var handlers = new WorkItemHandlers();
handlers.Register<HelloWorldWorkItem, HelloWorldWorkItemHandler>();
// Register the handlers with dependency injection.
container.AddSingleton(handlers);
// Register the queue for WorkItemData.
container.AddSingleton<IQueue<WorkItemData>>(s => new InMemoryQueue<WorkItemData>());
// The job runner will automatically look for and run all registered WorkItemHandlers.
new JobRunner(container.GetRequiredService<WorkItemJob>(), instanceCount: 2).RunInBackground();
// To trigger the job we need to queue the HelloWorldWorkItem message.
// This assumes that we injected an instance of IQueue<WorkItemData> queue
// NOTE: You may have noticed that HelloWorldWorkItem doesn't derive from WorkItemData.
// Foundatio has an extension method that takes the model you post and serializes it to the
// WorkItemData.Data property.
await queue.EnqueueAsync(new HelloWorldWorkItem { Message = "Hello World" });
We provide different file storage implementations that derive from the IFileStorage
interface:
We recommend using all of the IFileStorage
implementations as singletons.
using Foundatio.Storage;
IFileStorage storage = new InMemoryFileStorage();
await storage.SaveFileAsync("test.txt", "test");
string content = await storage.GetFileContentsAsync("test.txt")
We provide five implementations that derive from the IMetricsClient
interface:
We recommend using all of the IMetricsClient
implementations as singletons.
IMetricsClient metrics = new InMemoryMetricsClient();
metrics.Counter("c1");
metrics.Gauge("g1", 2.534);
metrics.Timer("t1", 50788);
We have both slides and a sample application that shows off how to use Foundatio.