Discussion API Performance

Initial observations:

from NewRelic Data from our current Forums service: 

  • What is HttpDispatcher? 

    • Seems like it gets called per other request. Is it something that connects services?

  • Sinatra::Application/GET api/v1/users/([^/?#]+) and Sinatra::Application/GET api/v1/threads/([^/?#]+) are called the most and account for 2/3 of the time.
    • Users is called many times in conjuction with other calls. Discussion API may not have to do this.
  • Notifications is not called that many times but it's average response time is the slowest and accounts for about 5% of the total time.
  • The average of most responses are 250 ms or less. Standard Deviation varies a lot. 
    • Given these large SDs, we can hopefully be able to replicate the behaviour when changing some of the variables such as # of threads in a course, or size of the text body.

Seeding forums data vs productions data:

 ProsCons
Seeding the Data
  • Known baseline
  • Baseline can be configured/customized
    • User scaling
    • Allows projections
  • Repeatable
  • Open source friendly
  • Need write scripts to seed the data
  • Need to analyze production data and seed data in such as way that it is realistic*
Using Production Data
  • Real Data
  • Readable usable
  • Open source unfriendly
  • Subject to change
  • Need to analyze this data to determine performance factors.
  • Non customizable

 

Process:

MA-1099 - Getting issue details... STATUS  

Part 1: Confirm performance factors for Discussion API (Endpoints are below)

MA-1102 - Getting issue details... STATUS  

Part 2: Define data to be used in load tests.

  • Leaning towards seeding the forums data. 
    • Write a script to seed data
  • Example: Measure out # of threads if threads are a factor and comparing it to what is in production and using some intuition. If a course has 1000 threads, than do some tests with 0, 100,1000,10000 threads? 

MA-1042 - Getting issue details... STATUS  

Part 3: Create loadtest file and do single flow test

  • Create locustfile for single endpoints
  • Use loadtest env
  • Get preliminary results for any glaring issues

 

MA-1082 - Getting issue details... STATUS

Part 4: Take NewRelic forums data and create+run flow test

  • Take NewRelic data and run a Flowtest

 

Endpoints: 

  • /courses/(course_id)/
    •  GET depends on # of courses
  • /course_topics/(course_id)
    • GET depends on # of topics, threads, children
  •  /threads/
    • GET parameters below
      • course_id depends on # of threads/comments
      • topic_id depends on # of threads/topics (Is this faster than a normal search?)
      • following, view, test_search should be the same, except it has a filter
      • order_by might be the same as the other fitlers, or faster
      • order_direction, page_size, page shouldn't matter
    • POST parameters should not affect performance
  • /threads/(thread_id)
    • GET Not implemented
    •  PATCH/DELETE Should be fast? Depends on # of threads?
  •  /comments
    • GET parameters
      • thread_id depends on # of threads
      • endorsed should be the same, except with filter
      • page_size, page, shouldn't matter
    • POST parameters
      • thread_id depends on the # of threads
  •  /comments/(comment_id)
    • GET not implemented
    • PATCH 
    • DELETE

Concerns:

  • If an endpoint that creates Threads/Comments varies in performance depending on the # of Threads/Comments, how would we go about this test?
    • Revisit this if this actually happens. Else, don't worry about this for now.
  • Will existing forums data affect performance of newly seeded data? Do we need to wipe the database?
    • Figure this out
    • TnL testing did not test for this

Notes:

  • Ideally, these test would be part of the new open sourced edx load tests repo
  • dfriedmanR (Deactivated) and Diana Huang are doing performance work on the ruby code of the forums
  • Brian Beggs is upgrading the mongo database so the ruby forums will be updated in the process. 
  • If DAPI and TnL performance tests vary too much, an LMS test may also be required.

July 28th - Aug 3rd NewRelic data for the Sinatra Ruby Forums service. 

 Click here to expand...

Ranked by Total Time

ActionApdexCountAvg (ms)SD (ms)Min (ms)Max (ms)Total (ms)Total (% time)Dissat (%)
HttpDispatcher0.98 [0.5]30908501094341.721900336000000100100
Sinatra::Application/GET api/v1/users/([^/?#]+)0.98 [0.5]127935599.64305.82000012700000037.940.7
Sinatra::Application/GET api/v1/threads/([^/?#]+)0.96 [0.5]6704271734475.92050011600000034.539
Sinatra::Application/GET api/v1/threads0.99 [0.5]22596395.63319.820100216000006.43.2
Sinatra::Application/GET api/v1/([^/?#]+)/threads0.97 [0.5]11000919097112.120000208000006.24.6
Sinatra::Application/POST api/v1/notifications0.86 [0.5]30695518111014.320000159000004.75.9
Sinatra::Application/PUT api/v1/users/([^/?#]+)0.99 [0.5]12738163.92806.61160081400002.42.1
Sinatra::Application/GET heartbeat1.0 [0.5]49351514.776.38.42160072700002.20.3
Sinatra::Application/POST api/v1/threads/([^/?#]+)/comments0.98 [0.5]2754016637465.61040045800001.40.6
Sinatra::Application/POST api/v1/([^/?#]+)/threads0.97 [0.5]1802513939826.91070025100000.70.6
Sinatra::Application/GET api/v1/users/([^/?#]+)/active_threads0.95 [0.5]1002521455415.71310021500000.60.7
Sinatra::Application/POST api/v1/comments/([^/?#]+)0.98 [0.5]1202217035570.8689020500000.60.3
Sinatra::Application/GET api/v1/users/([^/?#]+)/subscribed_threads0.94 [0.5]773522748412851017500000.50.6
Sinatra::Application/GET api/v1/comments/([^/?#]+)0.98 [0.5]2648160.73126.1814016100000.50.8
Sinatra::Application/GET api/v1/search/threads0.99 [0.5]1447498.330521.72190014200000.40.2
Sinatra::Application/POST api/v1/users/([^/?#]+)/subscriptions1.0 [0.5]2021353.118212.2555010700000.30.1
Sinatra::Application/PUT api/v1/comments/([^/?#]+)0.99 [0.5]423115230859.674206430000.20.1
Sinatra::Application/PUT api/v1/comments/([^/?#]+)/votes0.99 [0.5]395380.225324.437503170000.10
Sinatra::Application/PUT api/v1/threads/([^/?#]+)/votes0.99 [0.5]391279.828620.957103120000.10.1
Sinatra::Application/PUT api/v1/threads/([^/?#]+)0.99 [0.5]160389.131228.7381014300000
Sinatra::Application/DELETE api/v1/threads/([^/?#]+)0.98 [0.5]81014941525.7678012000000
Sinatra::Application/PUT api/v1/comments/([^/?#]+)/abuse_flag0.98 [0.5]37917432570.637806590000
Sinatra::Application/DELETE api/v1/comments/([^/?#]+)0.98 [0.5]42013350232.866205580000
Sinatra::Application/PUT api/v1/comments/([^/?#]+)/abuse_unflag0.98 [0.5]20516737070.136503420000
Sinatra::Application/DELETE api/v1/users/([^/?#]+)/subscriptions0.99 [0.5]46064.822113.528502980000
Sinatra::Application/PUT api/v1/threads/([^/?#]+)/pin0.99 [0.5]29576.72763036002260000
Sinatra::Application/DELETE api/v1/threads/([^/?#]+)/votes0.99 [0.5]30359.627818.630101810000
Sinatra::Application/DELETE api/v1/comments/([^/?#]+)/votes1.0 [0.5]32033.534.221.44631070000
Sinatra::Application/PUT api/v1/threads/([^/?#]+)/abuse_flag1.0 [0.5]*8678.953.331.6304678000
Sinatra::Application/PUT api/v1/threads/([^/?#]+)/abuse_unflag1.0 [0.5]*4897.58031.6398468000
Sinatra::Application/PUT api/v1/threads/([^/?#]+)/unpin1.0 [0.5]*3466.931.331.6188227000
Sinatra::Application/GET (unknown)1.0 [0.5]*342.20.5281.72.674.900
Sinatra::Application/HEAD (unknown)1.0 [0.5]*12.402.42.42.400

Ranked by Average Time

ActionApdexCountAvg (ms)SD (ms)Min (ms)Max (ms)Total (ms)Total (% time)Dissat (%)
Sinatra::Application/POST api/v1/notifications0.86 [0.5]30695518111014.320000159000004.75.9
Sinatra::Application/GET api/v1/users/([^/?#]+)/subscribed_threads0.94 [0.5]773522748412851017500000.50.6
Sinatra::Application/GET api/v1/users/([^/?#]+)/active_threads0.95 [0.5]1002521455415.71310021500000.60.7
Sinatra::Application/GET api/v1/([^/?#]+)/threads0.97 [0.5]11000919097112.120000208000006.24.6
Sinatra::Application/PUT api/v1/comments/([^/?#]+)/abuse_flag0.98 [0.5]37917432570.637806590000
Sinatra::Application/GET api/v1/threads/([^/?#]+)0.96 [0.5]6704271734475.92050011600000034.539
Sinatra::Application/POST api/v1/comments/([^/?#]+)0.98 [0.5]1202217035570.8689020500000.60.3
Sinatra::Application/PUT api/v1/comments/([^/?#]+)/abuse_unflag0.98 [0.5]20516737070.136503420000
Sinatra::Application/POST api/v1/threads/([^/?#]+)/comments0.98 [0.5]2754016637465.61040045800001.40.6
Sinatra::Application/PUT api/v1/comments/([^/?#]+)0.99 [0.5]423115230859.674206430000.20.1
Sinatra::Application/DELETE api/v1/threads/([^/?#]+)0.98 [0.5]81014941525.7678012000000
Sinatra::Application/POST api/v1/([^/?#]+)/threads0.97 [0.5]1802513939826.91070025100000.70.6
Sinatra::Application/DELETE api/v1/comments/([^/?#]+)0.98 [0.5]42013350232.866205580000
HttpDispatcher0.98 [0.5]30908501094341.721900336000000100100
Sinatra::Application/GET api/v1/users/([^/?#]+)0.98 [0.5]127935599.64305.82000012700000037.940.7
Sinatra::Application/GET api/v1/search/threads0.99 [0.5]1447498.330521.72190014200000.40.2
Sinatra::Application/PUT api/v1/threads/([^/?#]+)/abuse_unflag1.0 [0.5]*4897.58031.6398468000
Sinatra::Application/GET api/v1/threads0.99 [0.5]22596395.63319.820100216000006.43.2
Sinatra::Application/PUT api/v1/threads/([^/?#]+)0.99 [0.5]160389.131228.7381014300000
Sinatra::Application/PUT api/v1/comments/([^/?#]+)/votes0.99 [0.5]395380.225324.437503170000.10
Sinatra::Application/PUT api/v1/threads/([^/?#]+)/votes0.99 [0.5]391279.828620.957103120000.10.1
Sinatra::Application/PUT api/v1/threads/([^/?#]+)/abuse_flag1.0 [0.5]*8678.953.331.6304678000
Sinatra::Application/PUT api/v1/threads/([^/?#]+)/pin0.99 [0.5]29576.72763036002260000
Sinatra::Application/PUT api/v1/threads/([^/?#]+)/unpin1.0 [0.5]*3466.931.331.6188227000
Sinatra::Application/DELETE api/v1/users/([^/?#]+)/subscriptions0.99 [0.5]46064.822113.528502980000
Sinatra::Application/PUT api/v1/users/([^/?#]+)0.99 [0.5]12738163.92806.61160081400002.42.1
Sinatra::Application/GET api/v1/comments/([^/?#]+)0.98 [0.5]2648160.73126.1814016100000.50.8
Sinatra::Application/DELETE api/v1/threads/([^/?#]+)/votes0.99 [0.5]30359.627818.630101810000
Sinatra::Application/POST api/v1/users/([^/?#]+)/subscriptions1.0 [0.5]2021353.118212.2555010700000.30.1
Sinatra::Application/DELETE api/v1/comments/([^/?#]+)/votes1.0 [0.5]32033.534.221.44631070000
Sinatra::Application/GET heartbeat1.0 [0.5]49351514.776.38.42160072700002.20.3
Sinatra::Application/HEAD (unknown)1.0 [0.5]*12.402.42.42.400
Sinatra::Application/GET (unknown)1.0 [0.5]*342.20.5281.72.674.900

Ranked by Standard Deviation

ActionApdexCountAvg (ms)SD (ms)Min (ms)Max (ms)Total (ms)Total (% time)Dissat (%)
Sinatra::Application/POST api/v1/notifications0.86 [0.5]30695518111014.320000159000004.75.9
Sinatra::Application/GET api/v1/([^/?#]+)/threads0.97 [0.5]11000919097112.120000208000006.24.6
Sinatra::Application/GET api/v1/users/([^/?#]+)/active_threads0.95 [0.5]1002521455415.71310021500000.60.7
Sinatra::Application/DELETE api/v1/comments/([^/?#]+)0.98 [0.5]42013350232.866205580000
Sinatra::Application/GET api/v1/users/([^/?#]+)/subscribed_threads0.94 [0.5]773522748412851017500000.50.6
Sinatra::Application/GET api/v1/threads/([^/?#]+)0.96 [0.5]6704271734475.92050011600000034.539
HttpDispatcher0.98 [0.5]30908501094341.721900336000000100100
Sinatra::Application/GET api/v1/users/([^/?#]+)0.98 [0.5]127935599.64305.82000012700000037.940.7
Sinatra::Application/DELETE api/v1/threads/([^/?#]+)0.98 [0.5]81014941525.7678012000000
Sinatra::Application/POST api/v1/([^/?#]+)/threads0.97 [0.5]1802513939826.91070025100000.70.6
Sinatra::Application/POST api/v1/threads/([^/?#]+)/comments0.98 [0.5]2754016637465.61040045800001.40.6
Sinatra::Application/PUT api/v1/comments/([^/?#]+)/abuse_unflag0.98 [0.5]20516737070.136503420000
Sinatra::Application/POST api/v1/comments/([^/?#]+)0.98 [0.5]1202217035570.8689020500000.60.3
Sinatra::Application/GET api/v1/threads0.99 [0.5]22596395.63319.820100216000006.43.2
Sinatra::Application/PUT api/v1/comments/([^/?#]+)/abuse_flag0.98 [0.5]37917432570.637806590000
Sinatra::Application/GET api/v1/comments/([^/?#]+)0.98 [0.5]2648160.73126.1814016100000.50.8
Sinatra::Application/PUT api/v1/threads/([^/?#]+)0.99 [0.5]160389.131228.7381014300000
Sinatra::Application/PUT api/v1/comments/([^/?#]+)0.99 [0.5]423115230859.674206430000.20.1
Sinatra::Application/GET api/v1/search/threads0.99 [0.5]1447498.330521.72190014200000.40.2
Sinatra::Application/PUT api/v1/threads/([^/?#]+)/votes0.99 [0.5]391279.828620.957103120000.10.1
Sinatra::Application/PUT api/v1/users/([^/?#]+)0.99 [0.5]12738163.92806.61160081400002.42.1
Sinatra::Application/DELETE api/v1/threads/([^/?#]+)/votes0.99 [0.5]30359.627818.630101810000
Sinatra::Application/PUT api/v1/threads/([^/?#]+)/pin0.99 [0.5]29576.72763036002260000
Sinatra::Application/PUT api/v1/comments/([^/?#]+)/votes0.99 [0.5]395380.225324.437503170000.10
Sinatra::Application/DELETE api/v1/users/([^/?#]+)/subscriptions0.99 [0.5]46064.822113.528502980000
Sinatra::Application/POST api/v1/users/([^/?#]+)/subscriptions1.0 [0.5]2021353.118212.2555010700000.30.1
Sinatra::Application/PUT api/v1/threads/([^/?#]+)/abuse_unflag1.0 [0.5]*4897.58031.6398468000
Sinatra::Application/GET heartbeat1.0 [0.5]49351514.776.38.42160072700002.20.3
Sinatra::Application/PUT api/v1/threads/([^/?#]+)/abuse_flag1.0 [0.5]*8678.953.331.6304678000
Sinatra::Application/DELETE api/v1/comments/([^/?#]+)/votes1.0 [0.5]32033.534.221.44631070000
Sinatra::Application/PUT api/v1/threads/([^/?#]+)/unpin1.0 [0.5]*3466.931.331.6188227000
Sinatra::Application/GET (unknown)1.0 [0.5]*342.20.5281.72.674.900
Sinatra::Application/HEAD (unknown)1.0 [0.5]*12.402.42.42.400