AvroConvert 2.6.2
Apache Avro serializer for .NET.
See the version list below for details.
Install-Package AvroConvert -Version 2.6.2
dotnet add package AvroConvert --version 2.6.2
<PackageReference Include="AvroConvert" Version="2.6.2" />
paket add AvroConvert --version 2.6.2
Avro format combines readability of JSON and compression of binary data serialization.
Benefits
The main purpose of the project was to enhance communication between microservices. Replacing JSON with Avro brought three main benefits:
- Decreased the communication time between microservices
- Reduced the network traffic by about 30%
- Increased communication security - the data was not visible in plain JSON text
| Converter | Request time [ms] | Compressed size [kB] |
|-------------------------|-----------------------|----------------------|
| Json | 1076 | 9945 |
| Avro (default) | 509 | 2435 |
| Avro (Headless) | 465 | 2434 |
| Avro (Deflate encoding) | 453 | 206 |
In the purpose of introducing Avro API, I've written an article, which you can read here: https://xabe.net/why-avro-api-is-the-best-choice/
It contains also description of the format, detailed results of the benchmarks and implementation details.
Conclusion: <br>
Using Avro for communication between your services significantly reduces communication time and network traffic. Additionally choosing encoding (compression algorithm) can improve the results even further.
Features
- Serialization and deserialization data in Avro format
- Extended support for C# data structures: Dictionary, List, DateTime and many others
- Support for codecs: deflate, snappy, gzip
- Support for Attributes: DataContract, DataMember, DefaultValue, NullableSchema
- "Headless" - serialization and deserialization based on provided schema
Related packages
- Library containing functionalities, which enable communication between microservices via Http using Avro data format
- Library containing extensions for Confluent Kafka platform - used together with Kafka Consumer and Producer
Code samples
//Serialization
byte[] avroObject = AvroConvert.Serialize(object yourObject);
//Deserialization
CustomClass deserializedObject = AvroConvert.Deserialize<CustomClass>(byte[] avroObject);
//Generate Avro schema
//Model
public class SimpleTestClass
{
public string justSomeProperty { get; set; }
public long andLongProperty { get; set; }
}
//Action
string schemaInJsonFormat = AvroConvert.GenerateSchema(typeof(SimpleTestClass));
//Produces following schema:
"{"type":"record","name":"AvroConvert.SimpleTestClass","fields":[{"name":"justSomeProperty","type":"string"},{"name":"andLongProperty","type":"long"}]}"
//Read schema from Avro file
string schemaInJsonFormat = AvroConvert.GetSchema(byte[] avroObject)
License
AvroConvert is licensed under Attribution-NonCommercial-ShareAlike 3.0 Unported (CC BY-NC-SA 3.0) - see License for details
For commercial purposes purchase AvroConvert on website - Xabe.net
Contribution
We want to improve AvroConvert as much as possible. If you have any idea, found next possible feature, optimization opportunity or better way for integration, leave a comment or pull request.
Avro format combines readability of JSON and compression of binary data serialization.
Benefits
The main purpose of the project was to enhance communication between microservices. Replacing JSON with Avro brought three main benefits:
- Decreased the communication time between microservices
- Reduced the network traffic by about 30%
- Increased communication security - the data was not visible in plain JSON text
| Converter | Request time [ms] | Compressed size [kB] |
|-------------------------|-----------------------|----------------------|
| Json | 1076 | 9945 |
| Avro (default) | 509 | 2435 |
| Avro (Headless) | 465 | 2434 |
| Avro (Deflate encoding) | 453 | 206 |
In the purpose of introducing Avro API, I've written an article, which you can read here: https://xabe.net/why-avro-api-is-the-best-choice/
It contains also description of the format, detailed results of the benchmarks and implementation details.
Conclusion: <br>
Using Avro for communication between your services significantly reduces communication time and network traffic. Additionally choosing encoding (compression algorithm) can improve the results even further.
Features
- Serialization and deserialization data in Avro format
- Extended support for C# data structures: Dictionary, List, DateTime and many others
- Support for codecs: deflate, snappy, gzip
- Support for Attributes: DataContract, DataMember, DefaultValue, NullableSchema
- "Headless" - serialization and deserialization based on provided schema
Related packages
- Library containing functionalities, which enable communication between microservices via Http using Avro data format
- Library containing extensions for Confluent Kafka platform - used together with Kafka Consumer and Producer
Code samples
//Serialization
byte[] avroObject = AvroConvert.Serialize(object yourObject);
//Deserialization
CustomClass deserializedObject = AvroConvert.Deserialize<CustomClass>(byte[] avroObject);
//Generate Avro schema
//Model
public class SimpleTestClass
{
public string justSomeProperty { get; set; }
public long andLongProperty { get; set; }
}
//Action
string schemaInJsonFormat = AvroConvert.GenerateSchema(typeof(SimpleTestClass));
//Produces following schema:
"{"type":"record","name":"AvroConvert.SimpleTestClass","fields":[{"name":"justSomeProperty","type":"string"},{"name":"andLongProperty","type":"long"}]}"
//Read schema from Avro file
string schemaInJsonFormat = AvroConvert.GetSchema(byte[] avroObject)
License
AvroConvert is licensed under Attribution-NonCommercial-ShareAlike 3.0 Unported (CC BY-NC-SA 3.0) - see License for details
For commercial purposes purchase AvroConvert on website - Xabe.net
Contribution
We want to improve AvroConvert as much as possible. If you have any idea, found next possible feature, optimization opportunity or better way for integration, leave a comment or pull request.
Dependencies
-
.NETStandard 2.0
- Microsoft.CSharp (>= 4.7.0)
- Newtonsoft.Json (>= 12.0.2)
Used By
NuGet packages (3)
Showing the top 3 NuGet packages that depend on AvroConvert:
Package | Downloads |
---|---|
SolTechnology.Avro.Http
Library containing functionalities, which enable communication between microservices using Avro data format
|
|
SlimMessageBus.Host.Serialization.AvroConvert
Extension to SlimMessageBus that provides Avro serialization based on the AvroConvert library
|
|
SolTechnology.Avro.Kafka
Library containing extensions for Confluent Kafka platform
|
GitHub repositories
This package is not used by any popular GitHub repositories.
Version History
Version | Downloads | Last updated |
---|---|---|
2.7.0 | 1,182 | 12/18/2020 |
2.6.3 | 1,302 | 10/25/2020 |
2.6.2 | 87 | 10/23/2020 |
2.6.1 | 1,723 | 7/25/2020 |
2.6.0 | 160 | 7/22/2020 |
2.5.1 | 938 | 6/11/2020 |
2.5.0 | 470 | 5/15/2020 |
2.4.1 | 959 | 4/14/2020 |
2.4.0 | 447 | 3/25/2020 |
2.3.0 | 363 | 3/19/2020 |
2.2.2 | 574 | 2/7/2020 |
2.2.1 | 169 | 2/7/2020 |
2.2.0 | 224 | 1/27/2020 |
2.1.0 | 154 | 1/16/2020 |
2.0.0 | 148 | 1/4/2020 |
1.8.1 | 438 | 12/9/2019 |
1.8.0 | 874 | 8/30/2019 |
1.7.0 | 219 | 8/22/2019 |
1.6.0 | 239 | 7/22/2019 |
1.5.1 | 269 | 7/14/2019 |
1.5.0 | 262 | 7/11/2019 |
1.4.0 | 219 | 6/17/2019 |
1.3.0 | 256 | 6/4/2019 |
1.2.0 | 255 | 6/3/2019 |
1.1.0 | 244 | 5/28/2019 |
1.0.1 | 253 | 5/21/2019 |
1.0.0 | 405 | 4/24/2019 |
0.8.0 | 360 | 5/1/2019 |
0.7.0 | 442 | 4/22/2019 |
0.6.3 | 376 | 4/19/2019 |
0.6.2 | 403 | 4/19/2019 |
0.6.1 | 387 | 4/19/2019 |
0.6.0 | 393 | 4/19/2019 |
0.5.0 | 419 | 4/18/2019 |
0.3.0 | 501 | 4/11/2019 |
0.2.1 | 380 | 4/11/2019 |
0.2.0 | 395 | 4/11/2019 |
0.1.0 | 412 | 4/10/2019 |