multTasks #2
@ -69,6 +69,7 @@ public class MainHostedService : BackgroundService
|
|||||||
|
|
||||||
var bigTablesDic = new Dictionary<string, TableInfo>
|
var bigTablesDic = new Dictionary<string, TableInfo>
|
||||||
{
|
{
|
||||||
|
{"order",new TableInfo{SimulaRowCount=5019216 }},
|
||||||
{"order_block_plan",new TableInfo{SimulaRowCount=2725553 }},//CreateTime < 202301的删除
|
{"order_block_plan",new TableInfo{SimulaRowCount=2725553 }},//CreateTime < 202301的删除
|
||||||
{"order_block_plan_result",new TableInfo{SimulaRowCount=1174096 }},
|
{"order_block_plan_result",new TableInfo{SimulaRowCount=1174096 }},
|
||||||
{"order_box_block",new TableInfo{SimulaRowCount=29755672 }},
|
{"order_box_block",new TableInfo{SimulaRowCount=29755672 }},
|
||||||
@ -81,7 +82,6 @@ public class MainHostedService : BackgroundService
|
|||||||
var smallTablesDic = new Dictionary<string, TableInfo>
|
var smallTablesDic = new Dictionary<string, TableInfo>
|
||||||
{
|
{
|
||||||
{"machine",new TableInfo{SimulaRowCount=14655 }},
|
{"machine",new TableInfo{SimulaRowCount=14655 }},
|
||||||
{"order",new TableInfo{SimulaRowCount=5019216 }},
|
|
||||||
{"order_data_block",new TableInfo{SimulaRowCount=731800334 }},
|
{"order_data_block",new TableInfo{SimulaRowCount=731800334 }},
|
||||||
{"order_data_goods",new TableInfo{SimulaRowCount=25803671 }},
|
{"order_data_goods",new TableInfo{SimulaRowCount=25803671 }},
|
||||||
{"order_data_parts",new TableInfo{SimulaRowCount=468517543 }},
|
{"order_data_parts",new TableInfo{SimulaRowCount=468517543 }},
|
||||||
|
@ -14,7 +14,6 @@ using Serilog;
|
|||||||
using Microsoft.Extensions.Caching.Distributed;
|
using Microsoft.Extensions.Caching.Distributed;
|
||||||
using Serilog.Events;
|
using Serilog.Events;
|
||||||
|
|
||||||
|
|
||||||
await RunProgram();
|
await RunProgram();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -463,7 +462,8 @@ async Task RunProgram()
|
|||||||
AllowUserVariables = true,
|
AllowUserVariables = true,
|
||||||
IgnoreCommandTransaction = true,
|
IgnoreCommandTransaction = true,
|
||||||
TreatTinyAsBoolean = false,
|
TreatTinyAsBoolean = false,
|
||||||
MaximumPoolSize = 50
|
MaximumPoolSize = 50,
|
||||||
|
SslMode = MySqlSslMode.None,
|
||||||
}.ConnectionString;
|
}.ConnectionString;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -486,7 +486,7 @@ async Task RunProgram()
|
|||||||
|
|
||||||
host.Services.AddHostedService<MainHostedService>();
|
host.Services.AddHostedService<MainHostedService>();
|
||||||
host.Services.AddHostedService<TaskMonitorService>();
|
host.Services.AddHostedService<TaskMonitorService>();
|
||||||
host.Services.AddSingleton<IInputService, InputService>();
|
host.Services.AddSingleton<IInputService,InputService>();
|
||||||
host.Services.AddSingleton<ITransformService, TransformService>();
|
host.Services.AddSingleton<ITransformService, TransformService>();
|
||||||
host.Services.AddSingleton<IOutputService, OutputService>();
|
host.Services.AddSingleton<IOutputService, OutputService>();
|
||||||
var redisOptions = host.Configuration.GetSection("RedisCacheOptions").Get<RedisCacheOptions>() ?? new RedisCacheOptions();
|
var redisOptions = host.Configuration.GetSection("RedisCacheOptions").Get<RedisCacheOptions>() ?? new RedisCacheOptions();
|
||||||
|
@ -39,6 +39,8 @@ namespace ConsoleApp2.SimulationService
|
|||||||
}
|
}
|
||||||
foreach (var tableName in tasksOptions.TableInfoConfig.Keys)
|
foreach (var tableName in tasksOptions.TableInfoConfig.Keys)
|
||||||
{
|
{
|
||||||
|
_logger.LogInformation("Working table: {tableName}", tableName);
|
||||||
|
|
||||||
var dataCount = tasksOptions.TableInfoConfig[tableName].SimulaRowCount;//当前表要生成的总数据量
|
var dataCount = tasksOptions.TableInfoConfig[tableName].SimulaRowCount;//当前表要生成的总数据量
|
||||||
var companyTotallCount = 1000;//当前表每个公司生成的总数据量
|
var companyTotallCount = 1000;//当前表每个公司生成的总数据量
|
||||||
var tempRecords = new List<DataRecord>();
|
var tempRecords = new List<DataRecord>();
|
||||||
@ -51,7 +53,7 @@ namespace ConsoleApp2.SimulationService
|
|||||||
var shareKeyIntervalCount = 0;
|
var shareKeyIntervalCount = 0;
|
||||||
|
|
||||||
var source = _dataInputOptions.Value.CreateSource?.Invoke(tableName);
|
var source = _dataInputOptions.Value.CreateSource?.Invoke(tableName);
|
||||||
var testRecord =await source.GetTestRecord();
|
var testRecord = await source.GetTestRecord();
|
||||||
for (long i = 1; i <= dataCount; i++)
|
for (long i = 1; i <= dataCount; i++)
|
||||||
{
|
{
|
||||||
shareKeyIntervalCount++;
|
shareKeyIntervalCount++;
|
||||||
@ -111,6 +113,10 @@ namespace ConsoleApp2.SimulationService
|
|||||||
foreach (var rc in tempRecords)
|
foreach (var rc in tempRecords)
|
||||||
{
|
{
|
||||||
_context.AddInput();
|
_context.AddInput();
|
||||||
|
if(_context.InputCount== 2000000)
|
||||||
|
{
|
||||||
|
var a = 1;
|
||||||
|
}
|
||||||
producerQueue.Enqueue(rc);
|
producerQueue.Enqueue(rc);
|
||||||
if (cancellationToken.IsCancellationRequested)
|
if (cancellationToken.IsCancellationRequested)
|
||||||
return;
|
return;
|
||||||
@ -125,7 +131,7 @@ namespace ConsoleApp2.SimulationService
|
|||||||
//_logger.LogInformation("File '{File}' input completed", Path.GetFileName(sqlPath));
|
//_logger.LogInformation("File '{File}' input completed", Path.GetFileName(sqlPath));
|
||||||
}
|
}
|
||||||
|
|
||||||
_context.CompleteInput();
|
context.CompleteInput();
|
||||||
_logger.LogInformation("***** Csv input service completed *****");
|
_logger.LogInformation("***** Csv input service completed *****");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user