修复仅skip下的bug,并且发布x.3.1.72
This commit is contained in:
parent
56febdcdfe
commit
d917259ac7
|
@ -84,7 +84,7 @@ AMD Ryzen 9 3900X, 1 CPU, 24 logical and 12 physical cores
|
|||
| NoShardingNoIndexToListAsync | 10 | 26,001.850 ms | 89.2787 ms | 69.7030 ms | 25,998.407 ms |
|
||||
| ShardingNoIndexToListAsync | 10 | 5,490.659 ms | 71.8199 ms | 67.1804 ms | 5,477.891 ms |
|
||||
|
||||
具体可以通过first前两次结果来计算得出结论单次查询的的损耗为0.2-0.3毫秒之间,通过数据聚合和数据路由的损耗单次在0.3ms-0.4ms,其中创建dbcontext为0.1毫秒目前没有好的优化方案,0.013毫秒左右是路由表达式解析和编译,复杂表达式可能更加耗时,剩下的0.2毫秒为数据源和表后缀的解析等操作包括实例的反射创建和数据的聚合,
|
||||
具体可以通过first前两次结果来计算得出结论单次查询的的损耗为0.2-0.3毫秒之间,通过数据聚合和数据路由的损耗单次在0.2ms-0.3ms,其中创建dbcontext为0.1毫秒目前没有好的优化方案,0.013毫秒左右是路由表达式解析和编译,复杂表达式可能更加耗时,剩下的0.2毫秒为数据源和表后缀的解析等操作包括实例的反射创建和数据的聚合,
|
||||
sqlserver的各项数据在分表和未分表的情况下都几乎差不多可以得出在770w数据集情况下数据库还并未是数据瓶颈的关键,但是mysql可以看到在分表和未分表的情况下如果涉及到没有索引的全表扫描那么性能的差距将是分表后的表数目之多,测试中为5-6倍,也就是分表数目
|
||||
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
:start
|
||||
::定义版本
|
||||
set EFCORE2=2.3.1.71
|
||||
set EFCORE3=3.3.1.71
|
||||
set EFCORE5=5.3.1.71
|
||||
set EFCORE6=6.3.1.71
|
||||
set EFCORE2=2.3.1.72
|
||||
set EFCORE3=3.3.1.72
|
||||
set EFCORE5=5.3.1.72
|
||||
set EFCORE6=6.3.1.72
|
||||
|
||||
::删除所有bin与obj下的文件
|
||||
@echo off
|
||||
|
|
|
@ -70,7 +70,7 @@ namespace ShardingCore.Sharding.MergeEngines.EnumeratorStreamMergeEngines.Enumer
|
|||
IStreamMergeAsyncEnumerator<TEntity>[] streamsAsyncEnumerators)
|
||||
{
|
||||
if (StreamMergeContext.IsPaginationQuery())
|
||||
return new PaginationStreamMergeAsyncEnumerator<TEntity>(StreamMergeContext, streamsAsyncEnumerators,0, StreamMergeContext.Skip.GetValueOrDefault() + StreamMergeContext.Take.GetValueOrDefault());
|
||||
return new PaginationStreamMergeAsyncEnumerator<TEntity>(StreamMergeContext, streamsAsyncEnumerators,0, StreamMergeContext.GetPaginationReWriteTake());
|
||||
return base.CombineInMemoryStreamMergeAsyncEnumerator(streamsAsyncEnumerators);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ namespace ShardingCore.Sharding.StreamMergeEngines.EnumeratorStreamMergeEngines.
|
|||
IStreamMergeAsyncEnumerator<TEntity>[] streamsAsyncEnumerators)
|
||||
{
|
||||
if (StreamMergeContext.IsPaginationQuery())
|
||||
return new PaginationStreamMergeAsyncEnumerator<TEntity>(StreamMergeContext, streamsAsyncEnumerators, 0, StreamMergeContext.Skip.GetValueOrDefault() + StreamMergeContext.Take.GetValueOrDefault());
|
||||
return new PaginationStreamMergeAsyncEnumerator<TEntity>(StreamMergeContext, streamsAsyncEnumerators, 0, StreamMergeContext.GetPaginationReWriteTake());
|
||||
return base.CombineInMemoryStreamMergeAsyncEnumerator(streamsAsyncEnumerators);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -179,6 +179,12 @@ namespace ShardingCore.Sharding
|
|||
return _source;
|
||||
}
|
||||
|
||||
public int? GetPaginationReWriteTake()
|
||||
{
|
||||
if (Take.HasValue)
|
||||
return Skip.GetValueOrDefault() + Take.Value;
|
||||
return default;
|
||||
}
|
||||
//public bool HasSkipTake()
|
||||
//{
|
||||
// return Skip.HasValue || Take.HasValue;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
<TargetFramework>net6.0</TargetFramework>
|
||||
<DefineConstants>TRACE;DEBUG;EFCORE6Test;</DefineConstants>
|
||||
<AssemblyName>ShardingCore.Test</AssemblyName>
|
||||
<LangVersion>10.0</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -129,6 +129,7 @@ namespace ShardingCore.Test
|
|||
var logDays = Enumerable.Range(0, 100).Select(o => new LogDay() { Id = Guid.NewGuid(), LogLevel = "info", LogBody = o.ToString(), LogTime = dateTime.AddDays(o) }).ToList();
|
||||
|
||||
var bulkShardingTableEnumerable = _virtualDbContext.BulkShardingTableEnumerable(logDays);
|
||||
|
||||
Assert.Equal(100, bulkShardingTableEnumerable.Count);
|
||||
var bulkShardingEnumerable = _virtualDbContext.BulkShardingEnumerable(logDays);
|
||||
Assert.Equal(1, bulkShardingEnumerable.Count);
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using ShardingCore.Core.EntityMetadatas;
|
||||
using ShardingCore.Core.ExtensionExpressionComparer;
|
||||
|
@ -21,6 +16,11 @@ using ShardingCore.Sharding.ShardingComparision.Abstractions;
|
|||
using ShardingCore.TableCreator;
|
||||
using ShardingCore.Test.Domain.Entities;
|
||||
using ShardingCore.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
|
||||
namespace ShardingCore.Test
|
||||
|
|
|
@ -40,7 +40,8 @@ namespace ShardingCore.Test
|
|||
#if DEBUG
|
||||
//o.CreateShardingTableOnStart = true;
|
||||
//o.EnsureCreatedWithOutShardingTable = true;
|
||||
#endif
|
||||
|
||||
#endif //o.MaxQueryConnectionsLimit = 1;
|
||||
o.AutoTrackEntity = true;
|
||||
})
|
||||
.AddShardingTransaction((connection, builder) =>
|
||||
|
|
Loading…
Reference in New Issue