public async Task MultithreadTest()
        {
            var          logWriter    = new StringWriterLog();
            var          threadsCount = 100;
            const string spaceName    = "performance";

            using (var tarantoolClient = new Client.Box(new ClientOptions(await ConnectionStringFactory.GetReplicationSource_1_7(), logWriter)))
            {
                tarantoolClient.Connect().GetAwaiter().GetResult();

                var schema = tarantoolClient.GetSchema();

                var index     = schema[spaceName]["primary"];
                var startTime = DateTime.Now;

                logWriter.WriteLine("Before start thread");

                var tasks = new Task[threadsCount];
                for (uint i = 0; i < threadsCount; i++)
                {
                    var client = new TestClient(index, i);
                    tasks[i] = Task.Factory.StartNew(client.Start);
                }

                Task.WaitAll(tasks);

                var endTime = DateTime.Now;

                logWriter.WriteLine($"Time taken:{(endTime - startTime).TotalMilliseconds} ms");
            }
        }
Exemplo n.º 2
0
 public async Task ClearDataAsync(params string[] spaceNames)
 {
     using (var tarantoolClient = await Client.Box.Connect(ConnectionStringFactory.GetReplicationSource_1_7("admin:adminPassword")))
     {
         await tarantoolClient.Call("clear_data", TarantoolTuple.Create(spaceNames));
     }
 }
        async Task IAsyncLifetime.InitializeAsync()
        {
            var options = new ClientOptions(await ConnectionStringFactory.GetReplicationSource_1_7(), _stringWriterLog);

            _tarantoolClient = new Client.Box(options);
            await _tarantoolClient.Connect();

            _multiplexer = await ConnectionMultiplexer.ConnectAsync(await ConnectionStringFactory.GetRedisConnectionString());
        }