Skip to content
New issue

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

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

Already on GitHub? # to your account

HTTPDecoder: don't deliver unsolicited responses #1093

Merged
merged 1 commit into from
Aug 6, 2019

Conversation

weissi
Copy link
Member

@weissi weissi commented Aug 6, 2019

Motivation:

Despite the fact that we already stopped delivering unsolicited
responses for the HTTP response decoder, there was a window where we
would deliver a second .head for a response that come without a request.

Modifications:

Don't deliver a second .head even if send together with a first, legit
response.

Result:

Being a HTTP client using NIO is now easier.

@weissi weissi requested a review from Lukasa August 6, 2019 14:42
@weissi weissi force-pushed the jw-be-single-headed branch from b7c9c67 to 6963f40 Compare August 6, 2019 14:46
@weissi
Copy link
Member Author

weissi commented Aug 6, 2019

@swift-nio-bot test perf please

Motivation:

Despite the fact that we already stopped delivering unsolicited
responses for the HTTP response decoder, there was a window where we
would deliver a second .head for a response that come without a request.

Modifications:

Don't deliver a second .head even if send together with a first, legit
response.

Result:

Being a HTTP client using NIO is now easier.
@weissi weissi force-pushed the jw-be-single-headed branch from 6963f40 to fc407d9 Compare August 6, 2019 14:53
@weissi weissi requested a review from Lukasa August 6, 2019 14:53
@apple apple deleted a comment from swift-nio-bot Aug 6, 2019
@weissi
Copy link
Member Author

weissi commented Aug 6, 2019

@swift-nio-bot test perf please

@swift-nio-bot
Copy link

performance report

build id: 11

timestamp: Tue Aug 6 14:57:10 UTC 2019

results

nameminmaxmeanstd
write_http_headers 0.004672050476074219 0.004701972007751465 0.004682493209838867 8.639215274420695e-06
bytebuffer_write_12MB_short_string_literals 0.4871819019317627 0.4940100908279419 0.48902039527893065 0.0018799653005042425
bytebuffer_write_12MB_short_calculated_strings 0.49014902114868164 0.4918309450149536 0.49094557762145996 0.0004974480861775824
bytebuffer_write_12MB_medium_string_literals 0.18102598190307617 0.18423199653625488 0.18161729574203492 0.0009781288441399914
bytebuffer_write_12MB_medium_calculated_strings 0.23320090770721436 0.23453402519226074 0.23363288640975952 0.00036782887387042654
bytebuffer_write_12MB_large_calculated_strings 0.21282804012298584 0.21382200717926025 0.21327890157699586 0.0002855270641293843
bytebuffer_lots_of_rw 0.5475389957427979 0.555306077003479 0.5494376063346863 0.002277967902230494
bytebuffer_write_http_response_ascii_only_as_string 0.039848923683166504 0.04050302505493164 0.04005320072174072 0.00023919532793854672
bytebuffer_write_http_response_ascii_only_as_staticstring 0.029270052909851074 0.029846906661987305 0.029430699348449708 0.00022141405569751815
bytebuffer_write_http_response_some_nonascii_as_string 0.03985905647277832 0.040418028831481934 0.039982497692108154 0.00022256794173638935
bytebuffer_write_http_response_some_nonascii_as_staticstring 0.029218077659606934 0.029819965362548828 0.029368603229522706 0.0002376952062195706
no-net_http1_10k_reqs_1_conn 0.14649200439453125 0.1478569507598877 0.1471501111984253 0.0003900635924291901
http1_10k_reqs_1_conn 0.5829799175262451 0.586804986000061 0.5848252892494201 0.0013004454023887095
http1_10k_reqs_100_conns 0.5819300413131714 0.5867229700088501 0.5844359993934631 0.0015633035310051201
future_whenallsucceed_100k_immediately_succeeded_off_loop 0.1235039234161377 0.12495195865631104 0.12418497800827026 0.0004439429397698077
future_whenallsucceed_100k_immediately_succeeded_on_loop 0.12438499927520752 0.13578295707702637 0.12640070915222168 0.0033940595117112485
future_whenallsucceed_100k_deferred_off_loop 0.6110810041427612 0.6168539524078369 0.613690710067749 0.0017875830012681166
future_whenallsucceed_100k_deferred_on_loop 0.19170498847961426 0.19366800785064697 0.19259120225906373 0.000623231330295191
future_whenallcomplete_100k_immediately_succeeded_off_loop 0.10088801383972168 0.10258305072784424 0.10164060592651367 0.0007104215193182487
future_whenallcomplete_100k_immediately_succeeded_on_loop 0.10087597370147705 0.10293400287628174 0.10171210765838623 0.0007397542620493532
future_whenallcomplete_100k_deferred_off_loop 0.5878069400787354 0.6022310256958008 0.5959251046180725 0.004098161695396617
future_whenallcomplete_100k_deferred_on_loop 0.17399001121520996 0.18085205554962158 0.1757832169532776 0.0019693970897714224
future_reduce_10k_futures 0.04932093620300293 0.050221920013427734 0.04979032278060913 0.00023765166603867302
future_reduce_into_10k_futures 0.05013096332550049 0.05124092102050781 0.05061229467391968 0.00036136780359037694
channel_pipeline_1m_events 0.2188739776611328 0.21908092498779297 0.21894439458847045 7.563163309064769e-05

comparison

name current previous winner diff
write_http_headers 0.004682493209838867 0.0047024011611938475 previous 0%
bytebuffer_write_12MB_short_string_literals 0.48902039527893065 0.4893687844276428 current 0%
bytebuffer_write_12MB_short_calculated_strings 0.49094557762145996 0.49095200300216674 previous 0%
bytebuffer_write_12MB_medium_string_literals 0.18161729574203492 0.18113089799880983 previous 0%
bytebuffer_write_12MB_medium_calculated_strings 0.23363288640975952 0.2331204056739807 previous 0%
bytebuffer_write_12MB_large_calculated_strings 0.21327890157699586 0.2108012080192566 previous 1%
bytebuffer_lots_of_rw 0.5494376063346863 0.6138427138328553 current -10%
bytebuffer_write_http_response_ascii_only_as_string 0.04005320072174072 0.04070550203323364 current -1%
bytebuffer_write_http_response_ascii_only_as_staticstring 0.029430699348449708 0.029402494430541992 current 0%
bytebuffer_write_http_response_some_nonascii_as_string 0.039982497692108154 0.04065009355545044 current -1%
bytebuffer_write_http_response_some_nonascii_as_staticstring 0.029368603229522706 0.02929360866546631 previous 0%
no-net_http1_10k_reqs_1_conn 0.1471501111984253 0.1512933850288391 current -2%
http1_10k_reqs_1_conn 0.5848252892494201 0.587480092048645 previous 0%
http1_10k_reqs_100_conns 0.5844359993934631 0.5857821941375733 current 0%
future_whenallsucceed_100k_immediately_succeeded_off_loop 0.12418497800827026 0.1207085132598877 previous 3%
future_whenallsucceed_100k_immediately_succeeded_on_loop 0.12640070915222168 0.12248148918151855 previous 3%
future_whenallsucceed_100k_deferred_off_loop 0.613690710067749 0.6143378973007202 previous 0%
future_whenallsucceed_100k_deferred_on_loop 0.19259120225906373 0.19010151624679567 previous 1%
future_whenallcomplete_100k_immediately_succeeded_off_loop 0.10164060592651367 0.10232150554656982 current 0%
future_whenallcomplete_100k_immediately_succeeded_on_loop 0.10171210765838623 0.10184358358383179 previous 0%
future_whenallcomplete_100k_deferred_off_loop 0.5959251046180725 0.5962650060653687 current 0%
future_whenallcomplete_100k_deferred_on_loop 0.1757832169532776 0.17523090839385985 previous 0%
future_reduce_10k_futures 0.04979032278060913 0.049446606636047365 previous 0%
future_reduce_into_10k_futures 0.05061229467391968 0.050055181980133055 previous 0%
channel_pipeline_1m_events 0.21894439458847045 0.2216325044631958 current -1%

significant differences found

Copy link
Contributor

@Lukasa Lukasa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@Lukasa Lukasa added the 🔨 semver/patch No public API change. label Aug 6, 2019
@Lukasa Lukasa added this to the 2.7.0 milestone Aug 6, 2019
@weissi weissi merged commit f98ed18 into apple:master Aug 6, 2019
@weissi weissi deleted the jw-be-single-headed branch August 6, 2019 16:56
@Lukasa Lukasa modified the milestones: 2.7.0, 2.6.1 Aug 9, 2019
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
🔨 semver/patch No public API change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants