Skip to content

200-400ms insert latency with Tornado driver #4007

Closed

Description

@danielmewes

Reported by @v3ss0n in #2622 (comment) . See that post for details.

Activity

  1. added this to the 2.0 milestone on Apr 2, 2015
  2. v3ss0n commented on Apr 2, 2015

    @v3ss0n

    I will do actual benchmarks on this

  3. danielmewes commented on Apr 2, 2015

    @danielmewes
    MemberAuthor

    Thank you for your help @v3ss0n !

  4. v3ss0n commented on Apr 2, 2015

    @v3ss0n

    I updated to latest , built both server and drivers.
    Did a quick test , Ran 300 curl posts which does inserts:
    which does insert of
    {'body': "i fine thank you"}

    for i in {1..300}; curl -s -w "%{time_total}\n"  'http://localhost:8080/a/message/new' -H 'Cookie: _xsrf=2|7c871ce1|5268fc3046031a9dff766c0f28c3618a|1428000260' -H 'Origin: http://localhost:8080' -H 'Accept-Encoding: gzip,deflate' -H 'Accept-Language: en-US,en;q=0.8' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.104 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded' -H 'Accept: text/plain, */*' -H 'Referer: http://localhost:8080/' -H 'X-Requested-With: XMLHttpRequest' -H 'Connection: keep-alive' --data 'body=i+fine+%2C+thank+you&_xsrf=2%7C7c871ce1%7C5268fc3046031a9dff766c0f28c3618a%7C1428000260' --compressed -o /dev/null
    
    with pypy 2.5.0  0.027s min , 0.193s max , 0.072s avg
    with python 2.7.8  0.050s min , 0.139s max , 0.078s avg
    

    So latest seem fine ? what is expected reponse rate on Intel haswell core i7 3.2ghz with 16 GB RAM and 1TB SATA 7200 RPM ?

    EDIT: Fixed my mistake of seconds with ms.

  5. v3ss0n commented on Apr 2, 2015

    @v3ss0n

    Here is my working chat app example of rethinkdb and python based on Tornado Chatdemo.
    It decrease 40 lines of code in chat thanks to Change feeds, removing Buffer object.

    https://github.com/v3ss0n/rechat

    I am enjoying RethinDB so far. It give a lot better code quality thanks to awesome ReQL.

    You guys can do benchmarks with it.

  6. danielmewes commented on Apr 2, 2015

    @danielmewes
    MemberAuthor

    Thanks for the code and benchmark @v3ss0n .
    Since the app is using hard durability during insert it could be bottlenecking on the disk, but I'm not sure. The max of 193ms sounds very high. I'll give it a try later.

    If you want to test this out in the meantime, you can change
    messages = (yield evt.insert(message).run(con))
    to messages = (yield evt.insert(message, durability="soft").run(con))

  7. v3ss0n commented on Apr 2, 2015

    @v3ss0n

    good , i will test it.

  8. v3ss0n commented on Apr 2, 2015

    @v3ss0n
    pypy 2.5.0
    0.008s min
    0.012s mean
    0.040s max

    suprising! i will test with normal python.

  9. v3ss0n commented on Apr 2, 2015

    @v3ss0n

    on the server side 1.7 ms response rate is average 4.0 ms response rate is max. very good

  10. v3ss0n commented on Apr 2, 2015

    @v3ss0n

    Can we set that option as default somewhere? For application like chat/ instant messaging , durability is not necessary .

  11. danielmewes commented on Apr 2, 2015

    @danielmewes
    MemberAuthor

    You can set the default at table creation our through the table_config system table. See the API docs for table_create. 

  12. v3ss0n commented on Apr 2, 2015

    @v3ss0n

    Those over 100ms latencies happens like every 30 to 40 inserts.

  13. v3ss0n commented on Apr 2, 2015

    @v3ss0n

    Thanks , i will look into it.

  14. Tryneus commented on Apr 3, 2015

    @Tryneus
    Member

    I tried performing my own benchmarks to help locate any bottlenecks, here are my results:

    Each client runs 1000 POST requests serially. I tried with 1, 3, 10, 30, and 50 clients. Larger numbers of clients results in some errors, which I suspect is due to file descriptor limitations, but I didn't bother investigating. I tested with a single connection in the tornado app, and with a pool of 10 connections (round robined). For each case, I tested with hard durability, soft durability, and noreply queries.

    All times are in milliseconds and describe the total time taken for yield table.insert... to return. The exception is total which is the total time for that test case to complete, and is in seconds.

    1 connection, hard durability:

    clients total (s) min max avg stddev 90% 99%
    1 17.17 3.34 40.02 7.92 5.09 15.81 25.96
    3 18.87 3.14 69.57 9.11 6.45 16.79 35.28
    10 22.78 3.27 95.19 12.75 9.67 23.70 49.24
    30 42.65 3.41 123.35 25.75 12.25 41.78 67.31
    50 72.93 4.15 118.09 41.48 14.71 61.93 80.68

    1 connection, soft durability:

    clients total (s) min max avg stddev 90% 99%
    1 14.81 2.13 23.72 5.52 4.17 13.57 13.90
    3 16.21 1.84 26.15 6.23 4.52 14.14 21.75
    10 17.86 1.68 35.48 8.47 5.35 16.46 25.67
    30 40.25 2.67 66.88 21.53 8.72 33.93 48.53
    50 71.24 1.95 104.21 37.43 12.66 53.12 75.74

    1 connection, noreply:

    clients total (s) min max avg stddev 90% 99%
    1 9.65 0.15 1.38 0.31 0.10 0.31 0.87
    3 10.28 0.14 7.52 0.33 0.18 0.45 0.97
    10 10.85 0.14 10.05 0.19 0.23 0.24 0.52
    30 34.07 0.14 10.87 0.20 0.19 0.25 0.54
    50 59.46 0.14 17.89 0.21 0.26 0.27 0.57

    10 connections, hard durability:

    clients total (s) min max avg stddev 90% 99%
    1 17.06 3.73 32.39 7.44 4.54 15.32 25.46
    3 18.54 3.19 68.56 8.63 6.46 16.09 36.23
    10 22.48 2.85 175.20 12.41 11.11 24.41 55.06
    30 45.69 3.61 166.72 24.70 13.12 42.96 67.84
    50 73.87 4.38 177.69 40.86 15.63 61.68 81.50

    10 connections, soft durability:

    clients total (s) min max avg stddev 90% 99%
    1 14.98 2.08 29.03 5.63 4.39 13.64 18.41
    3 16.47 1.93 66.28 6.41 5.14 14.11 23.93
    10 18.16 1.85 148.29 8.22 6.15 16.09 24.80
    30 43.28 2.17 155.67 22.96 9.43 34.02 52.68
    50 75.26 2.04 204.43 37.60 14.19 55.32 76.64

    10 connections, noreply:

    clients total (s) min max avg stddev 90% 99%
    1 9.85 0.15 1.59 0.32 0.12 0.35 0.95
    3 10.04 0.15 7.88 0.32 0.20 0.45 0.97
    10 10.86 0.15 5.71 0.19 0.16 0.24 0.50
    30 37.11 0.14 13.30 0.22 0.22 0.28 0.58
    50 61.32 0.14 18.44 0.22 0.23 0.28 0.58

    I'll perform some more analysis on what these numbers mean shortly.

  15. 18 remaining items

  16. v3ss0n commented on Apr 9, 2015

    @v3ss0n

    Also if there any test performed on SATA drives please let me know. Would like to see , coz i have a friend who want to try RethinkDB because RethinkDB take cares about data integrity . Although not fully ACID. Other NoSQLs do not . For my case Soft Durability is good!

  17. danielmewes commented on Apr 9, 2015

    @danielmewes
    MemberAuthor

    @v3ss0n

    Also if there any test performed on SATA drives please let me know.

    You mean something similar to @Tryneus' test but on rotational drives?

  18. v3ss0n commented on Apr 9, 2015

    @v3ss0n

    yes , for comparison

  19. danielmewes commented on Apr 16, 2015

    @danielmewes
    MemberAuthor

    Moving to subsequent for additional benchmarks.

  20. modified the milestones: subsequent, on Apr 16, 2015
  21. v3ss0n commented on Feb 9, 2017

    @v3ss0n

    as of rethinkdb 2.3.5 , there is no more random 200-400ms delays originally.
    we are running in production and there is no such problems anymore.

  22. AtnNn commented on Feb 13, 2017

    @AtnNn
    Member

    Thanks for the update.

    If this happens again or if there is more benchmarking to do, please open a new issue.

  23. modified the milestones: outdated, backlog on Feb 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions