Moonglade

Modern Markdown blogging with AI-powered localization and search.

Tag: .NET Core




Query a Kusto database with C# and get the result as a List<T>.

This article introduces KustoBuffer, a high-performance non-blocking data buffering component designed to optimize bulk write performance to Kusto databases. The design draws on the implementation approach of ArrayDb, with its core mechanism employing a double-buffering strategy that leverages concurrent queues to decouple data writing from persistence. The system controls the write flow through engine tasks and incorporates a cooling engine mechanism, which dynamically calculates sleep time based on the amount of data in the buffer, thereby balancing write frequency against data fragmentation issues. The article provides detailed code implementations, including thread-safe buffer exchange logic, a logarithmic-function-based sleep time algorithm, and synchronization methods that ensure eventual data consistency. This solution effectively avoids lock contention in high-concurrency scenarios, improves system throughput, and prevents resource waste through fine-grained state management, offering a robust and efficient solution for large-scale data write scenarios.

Views 3,411
.NET .NET Core Azure Azure Data Explorer C# KQL Kusto







Getting the Push Stream URL and Playback URL for Tencent Cloud Live in C#

This article documents the practical process of integrating Tencent Cloud live streaming push functionality in a C# environment. Since Tencent Cloud officially provides code examples only in Java and PHP, and the push URL must be generated on the client side, the author successfully reverse-engineered the Java examples to decipher the generation logic of the critical parameter `txTime`, confirming it to be a Unix timestamp counting from January 1, 1970. Subsequently, the author implemented the complete signing algorithm in C#, including calculating the MD5 value, string concatenation, and conversion to hexadecimal format, ultimately generating valid push and playback addresses. The article details the complete code implementation from timestamp conversion and MD5 encryption to final URL construction, resolving the difficulty C# developers face in understanding the signing mechanism due to the lack of official documentation support. It provides a reusable technical solution and code reference for integrating live streaming features in similar scenarios.

Views 614
.NET Core C# China Live Streaming Tencent Cloud Tencent Cloud Live