
Security News
npm ‘is’ Package Hijacked in Expanding Supply Chain Attack
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.
AutoCSer is a distributed application infrastructure framework implemented in C#. Its core is a full-duplex RPC component based on TCP long connections, featuring high concurrency, high throughput and other high-performance characteristics. AutoCSer based on the implementation of support reliable persistence and object-oriented programming memory database, high concurrency throughput performance is much higher than Garnet + StackExchange.Redis, support according to the business logic to customize any data structure node, Supports the local embedding mode to meet the needs of high-performance game intra-office services.
AutoCSer is a distributed application infrastructure framework implemented in C#. Its core is a full-duplex RPC component based on TCP long connections, featuring high concurrency, high throughput and other high-performance characteristics. The client provides .NET NativeAOT support.
In the high-concurrency practical environment of lightweight apis, AutoCSer RPC can provide a QPS throughput performance of over 1 million per second for a single node. The test throughput performance is one order of magnitude higher than .NET gRPC.
The in-memory database that supports object-oriented programming and is implemented based on AutoCSer RPC. It supports reliable persistence at the level of traditional databases. The persistence API has inherent transaction characteristics. The local embedding mode supports .NET NativeAOT, which can meet the requirements of high-performance in-game services.
In the high-concurrency practical environment of lightweight apis, the AutoCSer in-memory database can provide a TPS throughput performance of over 1 million per second on a single node. The test throughput performance is much higher than the Garnet + StackExchange.Redis combination.
NuGet has released three versions of its core assembly AutoCSer.dll, including .NET8 | .NET Standard 2.1 | .NET Standard 2.0. For the version .NET Framework 4.5 and other projects, you need to download the source code from github or atomgit and compile it yourself.
/// <summary>
/// Interface symmetry API interface definition
/// </summary>
public interface ISymmetryService
{
/// <summary>
/// Asynchronous API definition
/// </summary>
/// <param name="left"></param>
/// <param name="right"></param>
/// <returns></returns>
System.Threading.Tasks.Task<int> AddAsync(int left, int right);
/// <summary>
/// Synchronous API definition (It is not recommended to define the synchronous API in interface symmetric services, as the client synchronous blocking mode may cause performance bottlenecks)
/// </summary>
/// <param name="left"></param>
/// <param name="right"></param>
/// <returns></returns>
int Add(int left, int right);
}
/// <summary>
/// Interface symmetry API implementation
/// </summary>
internal sealed class SymmetryService : ISymmetryService
{
/// <summary>
/// Asynchronous API implementation
/// </summary>
/// <param name="left"></param>
/// <param name="right"></param>
/// <returns></returns>
System.Threading.Tasks.Task<int> ISymmetryService.AddAsync(int left, int right) { return System.Threading.Tasks.Task.FromResult(left + right); }
/// <summary>
/// Synchronous API implementation
/// </summary>
/// <param name="left"></param>
/// <param name="right"></param>
/// <returns></returns>
public int Add(int left, int right) { return left + right; }
}
AutoCSer.Net.CommandServerConfig config = new AutoCSer.Net.CommandServerConfig
{
Host = new AutoCSer.Net.HostEndPoint((ushort)AutoCSer.TestCase.Common.CommandServerPortEnum.Document)
};
await using (AutoCSer.Net.CommandListener commandListener = new AutoCSer.Net.CommandListener(config
, AutoCSer.Net.CommandServerInterfaceControllerCreator.GetCreator<ISymmetryService>(new SymmetryService())))
{
if (await commandListener.Start())
{
Console.ReadLine();
}
}
/// <summary>
/// Test client singleton (Full duplex connection only requires creating one client)
/// </summary>
private static readonly AutoCSer.Net.CommandClient<ISymmetryService> commandClient = new AutoCSer.Net.CommandClientConfig<ISymmetryService>
{
Host = new AutoCSer.Net.HostEndPoint((ushort)AutoCSer.TestCase.Common.CommandServerPortEnum.Document),
}.CreateSymmetryClient();
/// <summary>
/// Client test
/// </summary>
/// <returns></returns>
internal static async Task Test()
{
var client = await commandClient.GetSocketEvent();
if (client != null)
{
Console.WriteLine($"2 + 3 = {await client.InterfaceController.AddAsync(2, 3)}");
Console.WriteLine($"1 + 2 = {client.InterfaceController.Add(1, 2)}");
Console.WriteLine("Completed");
}
}
/// <summary>
/// In-memory database service configuration
/// </summary>
internal sealed class ServiceConfig : AutoCSer.CommandService.StreamPersistenceMemoryDatabaseServiceConfig
{
/// <summary>
/// The test environment deletes historical persistent files from the previous 15 minutes. The production environment processes the files based on site requirements
/// </summary>
/// <returns></returns>
public override DateTime GetRemoveHistoryFileTime()
{
return AutoCSer.Threading.SecondTimer.UtcNow.AddMinutes(-15);
}
/// <summary>
/// The test environment deletes persistent files once a minute. The production environment deletes persistent files based on site requirements
/// </summary>
/// <param name="service"></param>
/// <returns></returns>
public override void RemoveHistoryFile(AutoCSer.CommandService.StreamPersistenceMemoryDatabaseService service)
{
new AutoCSer.CommandService.StreamPersistenceMemoryDatabase.RemoveHistoryFile(service).Remove(new AutoCSer.Threading.TaskRunTimer(60.0)).Catch();
}
/// <summary>
/// Set the rebuild file size to at least 10MB
/// </summary>
/// <param name="service"></param>
/// <returns></returns>
public override bool CheckRebuild(AutoCSer.CommandService.StreamPersistenceMemoryDatabaseService service)
{
long persistencePosition = service.GetPersistencePosition();
return (persistencePosition >> 1) >= service.RebuildSnapshotPosition && persistencePosition > 10 << 20;
}
}
AutoCSer.Document.MemoryDatabaseNode.Server.ServiceConfig databaseServiceConfig = new AutoCSer.Document.MemoryDatabaseNode.Server.ServiceConfig
{
PersistencePath = Path.Combine(AutoCSer.TestCase.Common.Config.AutoCSerTemporaryFilePath, nameof(AutoCSer.Document.MemoryDatabaseNode)),
PersistenceSwitchPath = Path.Combine(AutoCSer.TestCase.Common.Config.AutoCSerTemporaryFilePath, nameof(AutoCSer.Document.MemoryDatabaseNode) + nameof(AutoCSer.Document.MemoryDatabaseNode.Server.ServiceConfig.PersistenceSwitchPath))
};
AutoCSer.CommandService.StreamPersistenceMemoryDatabaseService databaseService = databaseServiceConfig.Create();
AutoCSer.Net.CommandServerConfig commandServerConfig = new AutoCSer.Net.CommandServerConfig
{
Host = new AutoCSer.Net.HostEndPoint((ushort)AutoCSer.TestCase.Common.CommandServerPortEnum.Document),
};
await using (AutoCSer.Net.CommandListener commandListener = new AutoCSer.Net.CommandListenerBuilder(0)
.Append<AutoCSer.CommandService.IStreamPersistenceMemoryDatabaseService>(databaseService)
.CreateCommandListener(commandServerConfig))
{
if (await commandListener.Start())
{
Console.ReadKey();
}
}
/// <summary>
/// RPC client instance
/// </summary>
internal sealed class CommandClientSocketEvent : AutoCSer.Net.CommandClientSocketEventTask<CommandClientSocketEvent>, AutoCSer.CommandService.IStreamPersistenceMemoryDatabaseClientSocketEvent
{
/// <summary>
/// In-memory database client interface instance
/// </summary>
[AllowNull]
public AutoCSer.CommandService.IStreamPersistenceMemoryDatabaseClient StreamPersistenceMemoryDatabaseClient { get; private set; }
/// <summary>
/// The set of parameters for creating the client controller is used to create the client controller object during the initialization of the client socket, and also to automatically bind the controller properties based on the interface type of the client controller after the client socket passes the service authentication API
/// </summary>
public override IEnumerable<AutoCSer.Net.CommandClientControllerCreatorParameter> ControllerCreatorParameters
{
get
{
yield return new AutoCSer.Net.CommandClientControllerCreatorParameter(typeof(AutoCSer.CommandService.IStreamPersistenceMemoryDatabaseService), typeof(AutoCSer.CommandService.IStreamPersistenceMemoryDatabaseClient));
//yield return new AutoCSer.Net.CommandClientControllerCreatorParameter(typeof(AutoCSer.CommandService.StreamPersistenceMemoryDatabase.IReadWriteQueueService), typeof(AutoCSer.CommandService.IStreamPersistenceMemoryDatabaseClient));
}
}
/// <summary>
/// RPC client instance
/// </summary>
/// <param name="client">Command client</param>
public CommandClientSocketEvent(AutoCSer.Net.CommandClient client) : base(client) { }
}
/// <summary>
/// In-memory database client singleton
/// </summary>
public static readonly AutoCSer.CommandService.StreamPersistenceMemoryDatabaseClientCache<CommandClientSocketEvent> StreamPersistenceMemoryDatabaseClientCache = new AutoCSer.CommandService.StreamPersistenceMemoryDatabaseClientCache<CommandClientSocketEvent>(new AutoCSer.Net.CommandClientConfig
{
Host = new AutoCSer.Net.HostEndPoint((ushort)AutoCSer.TestCase.Common.CommandServerPortEnum.Document),
GetSocketEventDelegate = (client) => new CommandClientSocketEvent(client)
});
FAQs
AutoCSer is a distributed application infrastructure framework implemented in C#. Its core is a full-duplex RPC component based on TCP long connections, featuring high concurrency, high throughput and other high-performance characteristics. AutoCSer based on the implementation of support reliable persistence and object-oriented programming memory database, high concurrency throughput performance is much higher than Garnet + StackExchange.Redis, support according to the business logic to customize any data structure node, Supports the local embedding mode to meet the needs of high-performance game intra-office services.
We found that autocser.net8 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.
Security News
A critical flaw in the popular npm form-data package could allow HTTP parameter pollution, affecting millions of projects until patched versions are adopted.
Security News
Bun 1.2.19 introduces isolated installs for smoother monorepo workflows, along with performance boosts, new tooling, and key compatibility fixes.