| Npgsql 3.2.6 on Linux | 61,065 |
| Npgsql 3.2.6 on Windows | 85,845 |
| Undertow/Java | 119,638 |
| NodeJS | 22,287 |
| Peregrine on Windows | 154,396 |
| Peregrine on Linux | 123,010 |
Intel Xeon E5-1650 @ 3.50Ghz, 6 physical cores, 12 threads. 32GB DDR4
| Npgsql 3.2.6 on Linux | 59,676 |
| Npgsql 3.2.6 on Windows | 68,708 |
| PostgreSQL (Java/Undertow) | 119,638 |
| MySQL (Java/Undertow) | 75,452 |
| MongoDB (Java/Undertow) | 105,984 |
| SQL Server (.NET on Windows) | 69,000 |
var msg = await ReadExpecting<SomeType>();
async ValueTask<T> ReadExpecting<T>()
{
var msg = await ReadMessage();
if (msg is T expected)
return expected;
throw new NpgsqlException(...);
}
async ValueTask<T> ReadMessage() { ... }var msg = Expect<T>(await ReadMessage());
internal static T Expect<T>(IBackendMessage msg)
=> msg is T asT
? asT
: throw new NpgsqlException(...);
async ValueTask<T> ReadMessage() { ... }Reduced from ~7 layers to 2-3, ~3.5% RPS boost
Task Open() {
...
if (pool.TryAllocateFast(connString, out var connection))
return connection;
return OpenLong();
}
async Task OpenLong() {
...
}| Npgsql 3.2.6 on Linux | 61,065 |
| Npgsql 3.2.6 on Windows | 85,845 |
| Npgsql vNext on Linux | 97,906 (60%) |
| Npgsql vNext on Windows | 134,648 (56%) |
| Undertow/Java | 119,638 |
| NodeJS | 22,287 |
| Peregrine on Windows | 154,396 |
| Peregrine on Linux | 123,010 |