core icon indicating copy to clipboard operation
core copied to clipboard

Stress test contentlets with block editor field reference

Open fmontes opened this issue 2 years ago • 3 comments

Is your feature request related to a problem? Please describe.

Recently, we did a change to keep up to date the contentlet references in the block editor field in the contentlets.

Describe the solution you'd like

We need to benchmark /api calls in this change against the master branch to make sure we are performant.

Describe alternatives you've considered

N/A

Additional context

Some of the endpoints affected by this change:

  • Content API
  • Page API
  • GraphQL
    • Direct collection
    • Page
    • Search

Acceptance criteria

  • Confirm that the change will perform well.

fmontes avatar Sep 14 '22 17:09 fmontes

Hey team! Please add your planning poker estimate with Zenhub @hmoreras @jcastro-dotcms @jdotcms @rjvelazco

fmontes avatar Sep 14 '22 17:09 fmontes

Results of the stress test:

With  export DOT_REFRESH_BLOCK_EDITOR_REFERENCES=false

1- (Clean Cache) Request a contentlet with Block Editor including 2 contentlets, time: 57 ms
2- Request the #1 again (should be cached), time: 15ms
3- Update both contentlets and request (the block editor is cached, but the references is updated): 19ms
4- Request again (everything is updated and the refresh is minimum): 15ms

ab -n 10000 -c 10 http://localhost:8080/api/content/id/b4969491707ce2f43ca3d600961b85dc

Document Path:          /api/content/id/b4969491707ce2f43ca3d600961b85dc
Document Length:        2819 bytes

Concurrency Level:      10
Time taken for tests:   4.053 seconds
Complete requests:      10000
Failed requests:        0
Total transferred:      34010000 bytes
HTML transferred:       28190000 bytes
Requests per second:    2467.38 [#/sec] (mean)
Time per request:       4.053 [ms] (mean)
Time per request:       0.405 [ms] (mean, across all concurrent requests)
Transfer rate:          8194.87 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.7      0      72
Processing:     2    4   3.4      3      76
Waiting:        2    3   3.3      3      76
Total:          2    4   3.5      3      77

Percentage of the requests served within a certain time (ms)
  50%      3
  66%      4
  75%      4
  80%      4
  90%      4
  95%      5
  98%      6
  99%      7
 100%     77 (longest request)


—----------------------------------------------------------------------------------------------------------


With  export DOT_REFRESH_BLOCK_EDITOR_REFERENCES=true (this refresh even the cached, not only the db contentlet)

5- (Clean Cache) Request a contentlet with Block Editor including 2 contentlets, time: 57ms
6- Request the #1 again (should be cached), time: 18ms
7- Update both contentlets and request (the block editor is cached, but the references is updated): 26 ms
8- Request again (everything is updated and the refresh is minimum): 15ms

ab -n 10000 -c 10 http://localhost:8080/api/content/id/b4969491707ce2f43ca3d600961b85dc


Document Path:          /api/content/id/b4969491707ce2f43ca3d600961b85dc
Document Length:        2819 bytes

Concurrency Level:      10
Time taken for tests:   4.108 seconds
Complete requests:      10000
Failed requests:        0
Total transferred:      34010000 bytes
HTML transferred:       28190000 bytes
Requests per second:    2434.00 [#/sec] (mean)
Time per request:       4.108 [ms] (mean)
Time per request:       0.411 [ms] (mean, across all concurrent requests)
Transfer rate:          8084.02 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.1      0       2
Processing:     2    4   3.9      3      81
Waiting:        2    4   3.8      3      80
Total:          2    4   3.9      4      81

Percentage of the requests served within a certain time (ms)
  50%      4
  66%      4
  75%      4
  80%      4
  90%      5
  95%      6
  98%      6
  99%      7
 100%     81 (longest request)



jdotcms avatar Sep 16 '22 03:09 jdotcms

The summary analysis

the performance penalty is about: 8% extra in the worst case. However the point 4 vrs 8 (which is when everything is cache) has the same time.

the stress test throws a difference of 2.4%

In the end, clients can skip the cache block editor refreshing by using:

export DOT_REFRESH_BLOCK_EDITOR_REFERENCES=false

To avoid the refreshing in memory since publish instance should be kinda immutable

jdotcms avatar Sep 16 '22 03:09 jdotcms