Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Insert performance #127

fireya opened this issue Mar 20, 2018 · 1 comment

Insert performance #127

fireya opened this issue Mar 20, 2018 · 1 comment


Copy link

@fireya fireya commented Mar 20, 2018

I have noticed slow insert performance of insert operations in connector. To test this, i have made some benchmarks:
Create space:'pivot')'primary', { type = 'tree', parts = {1, 'num'}, unique = true})'rtree', { type = 'rtree', parts = {2, 'array'}, unique = false})

Test on lua:
function main_function()
  local t
  for i = 1,1000000,1 do
    t ={i,{i,i},i})
start_time = os.clock()
end_time = os.clock()
'insert done in ' .. end_time - start_time .. ' seconds'

Results: 4 seconds, or 250k per second

Test on go:
first, truncate space:
then test:

package main

import (


func main() {
	opts := tarantool.Opts{}
	conn, err := tarantool.Connect("", opts)

	// conn, err := tarantool.Connect("/path/to/tarantool.socket", opts)
	if err != nil {
		fmt.Println("Connection refused: %s", err.Error())
	start := time.Now()
	f := make([]*tarantool.Future, 0)
	for i := 0; i < 1000000; i++ {
		fut := conn.InsertAsync("pivot", []interface{}{i, []int{i, i}, i})
		f = append(f, fut)
	for _, element := range f {
		_, err := element.Get()
		if err != nil {
			fmt.Println("Insert failed: %s", err.Error())
	elapsed := time.Since(start)
	log.Printf("Insert took %s", elapsed)

Results: 6.74s or 148k per second

Now .net connector:

using System;
using System.Diagnostics;
using System.Threading.Tasks;
using ProGaudi.Tarantool.Client;
using ProGaudi.Tarantool.Client.Model;

namespace Tarantool.Test
    class Program
        static void Main(string[] args)
            using (var box = Box.Connect("").Result)
                var schema = box.GetSchema();
                var space = schema["pivot"];
                var sw = new Stopwatch();
                var lst = new Task[1000000];
                for (int i = 0; i < lst.Length; i++)
                    lst[i] = space.Insert(new TarantoolTuple<int, int[], int>(i, new[] { i, i }, i));


Time: 92 sec or 11k per second

Copy link

@aensidhe aensidhe commented Mar 25, 2018

I have better results (33k per second), but worse than that go results. You can improve by at least 30-50% by batching queries into batches of 1000, right now you're benchmarking .net GC more than actual code of library.

That does not mean, that I will leave it as it is. I'll need to rewrite our or adopt new msgpack library, most problem lie there. Unfortunately, can't provide any ETA as hard promises.

This branch has some drafts of what I want to do with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.