ArangoDb.Net driver performance

I am trying to use the new ArangoDb-Net override driver https://github.com/yojimbo87/ArangoDB-NET/tree/reimplement . Today I tried the job for the first time. When i used araongosh to do insert. It can insert about 5000 records per second. However, when I used the .Net driver to perform the same update. It took me about 2 minutes to complete the same installation. May I know what I did wrong? Thank.

[EDIT] completes the github discussion question I checked the code below with my arangosh

count=1;
startTime=+new Date();
console.log(startTime);
while(count <= 10000)
{
db.someCollection.save({"Id":"1234567890123456789012345678901234",
            "Key":1234567,
            "Revision":1234567,
            "Name":"Mohamad Abu Bakar",
            "IC Number":"1234567-12-3444",
            "Department":"IT Department",
            "Height":1234,
            "DateOfBirth":"2015-01-27 03:33",
            "Salary":3333});
    count++;
}
endTime=+new Date();
console.log(endTime);
console.log("Total time taken:" + (endTime - startTime)/1000);

      

The operation took 3.375 seconds to complete.

I am doing the same with a .Net driver and it took almost 9.5797819. Almost triple arangosh. Here's the code in .Net:

public static void TestArangoDb()
{
    //ASettings.AddConnection("_system", "127.0.0.1", 8529, false, "_system");
    //var db = new ADatabase("_system");
    //db.Create("trial_sample");

    ASettings.AddConnection("trial_sample",
                           "127.0.0.1", 8529, false, "trial_sample");
    var db2 = new ADatabase("trial_sample");

    db2.Collection.Create("someCollection");

    DateTime startTime = DateTime.Now;
    Console.WriteLine("Start Time: " + startTime.ToLongTimeString());

    for(int count=1; count <= 10000; count++)
    {
        var employee = new Employee();
        employee.Id = "1234567890123456789012345678901234";
        employee.Key = "1234567";
        employee.Revision = "1234567";
        employee.Name = "Mohamad Abu Bakar";
        employee.IcNumber = "1234567-12-3444";
        employee.Department = "IT Department";
        employee.Height = 1234;
        employee.DateOfBirth = new DateTime(2015, 1, 27, 3, 33, 3);
        employee.Salary = 3333;
        var result = db2.Document.Create<Employee>("someCollection", employee);

        //var updateDocument = new Dictionary<string, object>()
        //    .String("DocumentId", "SomeId");
        //db2.Document.Update(result.Value.String("_id"), updateDocument);
    }

    DateTime endTime = DateTime.Now;
    TimeSpan duration = endTime - startTime;
    Console.WriteLine("End Time: " + endTime.ToLongTimeString());
    Console.WriteLine("Total time taken: " + duration.TotalSeconds);
}

public class Employee 
{
    public string Id { get; set; }
    public string Key { get; set; }
    public string Revision { get; set; }
    public string Name { get; set; }
    public string IcNumber { get; set; }
    public string Email { get; set; }
    public string Department { get; set; }
    public double Height { get; set; }
    public DateTime DateOfBirth { get; set; }
    public decimal Salary { get; set; }
}

      

If I remove the comment for:

var updateDocument = new Dictionary<string, object>()
    .String("DocumentId", "SomeId");

db2.Document.Update(result.Value.String("_id"), updateDocument);

      

The performance is almost 30 times. Completed 99.8789133 seconds. In fact, I'm just doing an extra update to add an extra column.

Could you please suggest a problem with the code above? Thank.

+3


source to share


1 answer


yojimbo87 explored the issue deeper. Testing Various layers have identified the problem.

Merge query # 32 improves performance when creating, updating, and replacing documents / edges from shared objects by ~ 57%.



On the local machine, creating a single document with a given Employee example object now takes an average of ~ 0.4ms in a 10k iteration loop using a driver. A raw HTTP HTTP request (without any ArangoDB driver abstraction) takes ~ 0.35ms in a 10k loop. The difference is the conversion from a shared object to a dictionary, which needs to be done due to the handling of attributes (such as IgnoreField, IgnoreNullValue, and AliasField).

the NuGet package has been updated to reflect this improvement.

+2


source







All Articles