CCF icon indicating copy to clipboard operation
CCF copied to clipboard

[Draft, do-not-merge] Send response from within application code

Open eddyashton opened this issue 3 years ago • 1 comments

Extremely DRAFT, just opening for an easy diff view while I break out some of the standalone changes into separate PRs. This will likely remain a monster, but hopefully (eventually) an explicable one.

Implementation of #4219.

Headlines:

  • Loads of renames in the http:: namespace to clarify concepts, and avoid reuse of Endpoint. The main one is that Endpoint becomes Session
  • HTTP/2 implementation squeezed closer to HTTP/1.1, by separating a Parser object from the Session, and moving all the callbacks to a separate file
  • Making tls::Session a member-of rather than base-class-of the HTTPSession and HTTP2Session. Simplifies the class hierarchy, though it remains complex, and opens the door for a plain-text IO layer for all sessions
  • Broader use of std::span<const uint8_t>. I think this removes a bunch of unnecessary copies as we switch between moved vectors and raw pointers, but it enforces a single eventual copy. I dunno, I think its simpler to read regardless

The core difficulty, which I hadn't grokked before I was deep into the weeds, is the need for additional info in lookup -between a HTTP/1.1 session which can be looked up or referenced by a single ConnID, and a HTTP/2 session which sometimes needs an additional StreamId. In particular to respond to an actual request, we need a StreamId, but for early parsing errors/parity with HTTP/1.1, we may not have one. I think the right approach here is to break the concepts of a lifetime-managed TLS socket, from a writeable/readable request/response stream. This is 1-to-1 in HTTP/1.1, but 1-to-many in HTTP/2. This is partially done in this PR, with multiple HTTPResponders per HTTP2ServerSession, but this is incomplete.

eddyashton avatar Oct 06 '22 15:10 eddyashton

expose_forwarding@52002 aka 20221024.34 vs main ewma over 20 builds from 51552 to 51959

Click to see table

main

build_id build_number tpcc_virtual_cft^ tpcc_virtual_cft_mem ls_virtual_cft^ ls_virtual_cft_mem ls_jwt_virtual_cft^ ls_jwt_virtual_cft_mem ls_js_virtual_cft^ ls_js_virtual_cft_mem ls_full_js_virtual_cft^ ls_full_js_virtual_cft_mem ls_js_jwt_virtual_cft^ ls_js_jwt_virtual_cft_mem hist_sgx_cft^ tpcc_sgx_cft^ tpcc_sgx_cft_mem ls_sgx_cft^ ls_sgx_cft_mem ls_jwt_sgx_cft^ ls_jwt_sgx_cft_mem ls_js_sgx_cft^ ls_js_sgx_cft_mem ls_full_js_sgx_cft^ ls_full_js_sgx_cft_mem ls_js_jwt_sgx_cft^ ls_js_jwt_sgx_cft_mem RB put (/s)^ CHAMP put (/s)^ RB get (/s)^ CHAMP get (/s)^
51552 20221018.55 8720.44 0 34911.7 0 9261.82 0 4085.74 0 3347.54 0 3197.54 0 24649.6 6425.99 8.3497e+07 20823.3 1.63882e+07 6505.01 1.58639e+07 2485.32 1.00967e+07 2095.18 9.31027e+06 2010.82 9.31027e+06 917639 1.37977e+06 9.27952e+06 3.63121e+07
51560 20221019.3 11252.2 0 37041 0 10152.8 0 4368.85 0 3403.13 0 3365.06 0 28778.6 6359.85 8.3497e+07 20749 1.63882e+07 6418.94 1.58639e+07 2490.69 9.83456e+06 2105.81 9.31027e+06 2036.1 9.04813e+06 908117 1.37624e+06 9.41168e+06 3.66362e+07
51568 20221019.7 10865.4 0 37837.3 0 10050.4 0 4574.09 0 3426.37 0 3507.21 0 21129.7 5745.73 8.37592e+07 17946.8 1.71746e+07 6045.94 1.53396e+07 2356.59 9.83456e+06 1999.41 1.08831e+07 1975.93 9.31027e+06 905101 1.37374e+06 9.29629e+06 3.54933e+07
51596 20221019.17 9898.13 0 36578.3 0 9638.42 0 4265.05 0 3362.88 0 3199.59 0 23518.8 5697 8.29727e+07 17157.3 1.69124e+07 6161.39 1.56017e+07 2411.73 9.57242e+06 2017.64 9.31027e+06 1931.15 9.31027e+06 911715 1.37145e+06 9.17148e+06 3.58669e+07
51626 20221019.27 11126.6 0 42087 0 10128.4 0 4248.36 0 3590.06 0 3264.35 0 27871.7 5640.83 8.29727e+07 17643 1.58639e+07 6155.07 1.53396e+07 2345.98 9.57242e+06 1981.41 9.57242e+06 1930.93 9.04813e+06 911634 1.36897e+06 9.06993e+06 3.51884e+07
51650 20221020.3 11472.4 0 41541.8 0 10031.5 0 4301.53 0 3539.77 0 3209.56 0 28253.1 5786.4 8.27106e+07 18023.8 1.58639e+07 6135.44 1.56017e+07 2369.1 9.57242e+06 1991.09 9.57242e+06 1934.73 9.04813e+06 905029 1.39168e+06 9.22934e+06 3.56174e+07
51670 20221020.10 11143.3 0 42769.6 0 10308.8 0 4367.85 0 3535.13 0 3305.8 0 29115.5 5718.02 8.32349e+07 17836.8 1.69124e+07 6100.99 1.58639e+07 2367.39 9.57242e+06 1941.56 9.57242e+06 1923.17 9.31027e+06 891086 1.38743e+06 9.18789e+06 3.58036e+07
51694 20221020.18 10569.2 0 40721.7 0 10547.6 0 4237.22 0 3461.38 0 3256.86 0 20991.9 5528.74 8.29727e+07 17709.3 1.63882e+07 6105.49 1.56017e+07 2315.14 9.83456e+06 1981.1 9.57242e+06 1918.74 9.31027e+06 904667 1.39054e+06 9.45513e+06 3.60557e+07
51756 20221020.38 11145.5 0 43326.1 0 10685.5 0 4313.24 0 3571.63 0 3227.65 0 24478.8 5617 8.32349e+07 17658.7 1.66503e+07 6143.66 1.53396e+07 2350.65 9.83456e+06 2019.9 9.31027e+06 1928.99 9.57242e+06 897688 1.33107e+06 9.0981e+06 3.54939e+07
51800 20221020.52 11474.6 0 43005.4 0 10189.3 0 4329.56 0 3606.16 0 3095.43 0 24480.9 5792.02 8.42835e+07 17941.5 1.66503e+07 6099.91 1.56017e+07 2362.63 9.31027e+06 1984.09 9.57242e+06 1917.09 9.57242e+06 904628 1.37902e+06 9.22934e+06 3.56794e+07
51805 20221021.2 11181.3 0 42683.3 0 10188.4 0 4351.77 0 3461.51 0 3212.55 0 26940 5750.81 8.3497e+07 17709.5 1.71746e+07 6168.59 1.56017e+07 2345.54 9.57242e+06 1996.68 9.57242e+06 1921.35 9.04813e+06 902870 1.3806e+06 9.27948e+06 3.58669e+07
51813 20221021.5 11336.7 0 40642.5 0 11519.1 0 4260.82 0 3425.09 0 3223.42 0 28834.2 5793.12 8.3497e+07 17799.1 1.6126e+07 6120.3 1.56017e+07 2348.47 9.57242e+06 2044.46 9.31027e+06 1910.74 9.04813e+06 907679 1.37643e+06 9.22103e+06 3.59298e+07
51826 20221021.9 10567.1 0 42390.5 0 10341.2 0 4289.94 0 3385.16 0 3174.02 0 26911.8 5621.67 8.24484e+07 17870.6 1.6126e+07 6151.43 1.56017e+07 2357.11 9.57242e+06 1980.47 9.31027e+06 1926.41 9.04813e+06 885814 1.34551e+06 9.13063e+06 3.53713e+07
51832 20221021.11 10984.6 0 43765.1 0 10141 0 4366.3 0 3463.29 0 3228.09 0 24824.9 5611.78 8.3497e+07 17968.1 1.63882e+07 6067.88 1.56017e+07 2340.66 9.57242e+06 1975.36 9.57242e+06 1877.25 9.04813e+06 891090 1.36788e+06 9.21273e+06 3.56174e+07
51844 20221021.15 10939.3 0 42325.1 0 10632.1 0 4249.92 0 3457.66 0 3218.37 0 23210.3 5666.7 8.42835e+07 17806.4 1.63882e+07 6079.43 1.56017e+07 2310.1 9.57242e+06 2004.41 9.31027e+06 1914.02 9.31027e+06 908278 1.37283e+06 9.22099e+06 3.57411e+07
51922 20221023.1 11341.2 0 42755.5 0 10599.5 0 4421.86 0 3478.67 0 3215.35 0 24171.6 5780.97 8.21863e+07 17755.2 1.6126e+07 6062.06 1.53396e+07 2339.54 9.57242e+06 1976.51 9.57242e+06 1923.12 9.04813e+06 908401 1.36688e+06 9.14686e+06 3.57417e+07
51929 20221024.2 11020 0 42507.8 0 10714.4 0 4234.49 0 3585.69 0 3241.89 0 21619.3 5649.55 8.32349e+07 18197.1 1.66503e+07 6173.25 1.58639e+07 2353.95 9.31027e+06 1956.4 1.14074e+07 1881.83 9.04813e+06 924057 1.38349e+06 9.30901e+06 3.57411e+07
51934 20221024.4 11228.6 0 43074.1 0 10611.6 0 4309.36 0 3534.43 0 3202.17 0 28527.6 5696.81 8.37592e+07 17882.1 1.6126e+07 6157.47 1.58639e+07 2348.42 9.31027e+06 1978.09 1.27181e+07 1930.14 9.31027e+06 905468 1.35252e+06 9.41601e+06 3.56794e+07
51943 20221024.8 11138.8 0 41682.8 0 10100.2 0 4213.87 0 3372.76 0 3197.46 0 24870.3 5747.57 8.37592e+07 17784.2 1.63882e+07 6134.12 1.56017e+07 2359.15 9.83456e+06 1984.33 9.83456e+06 1930.04 9.31027e+06 898869 1.37809e+06 9.39876e+06 3.58669e+07
51959 20221024.15 11371.8 0 42816.8 0 10018.8 0 4301.09 0 3541.08 0 3206.07 0 24628.2 5782.18 8.45456e+07 17690.6 1.6126e+07 6032.81 1.56017e+07 2359.2 9.57242e+06 1980.58 9.57242e+06 1914.75 9.04813e+06 920195 1.36952e+06 9.33446e+06 3.58669e+07

expose_forwarding

build_id build_number tpcc_virtual_cft^ tpcc_virtual_cft_mem ls_virtual_cft^ ls_virtual_cft_mem tpcc_sgx_cft^ tpcc_sgx_cft_mem ls_jwt_virtual_cft^ ls_jwt_virtual_cft_mem ls_js_virtual_cft^ ls_js_virtual_cft_mem ls_sgx_cft^ ls_sgx_cft_mem ls_full_js_virtual_cft^ ls_full_js_virtual_cft_mem ls_jwt_sgx_cft^ ls_jwt_sgx_cft_mem ls_js_jwt_virtual_cft^ ls_js_jwt_virtual_cft_mem ls_js_sgx_cft^ ls_js_sgx_cft_mem ls_full_js_sgx_cft^ ls_full_js_sgx_cft_mem hist_sgx_cft^ ls_js_jwt_sgx_cft^ ls_js_jwt_sgx_cft_mem RB put (/s)^ CHAMP put (/s)^ RB get (/s)^ CHAMP get (/s)^
51842 20221021.14 11168.9 0 40979.1 0 5603.1 8.37592e+07 10405.9 0 4316.21 0 17592 1.6126e+07 3523.1 0 6549.29 1.56017e+07 3246.57 0 2352.35 9.57242e+06 1980 9.31027e+06 21898.8 1926.45 9.04813e+06 906870 1.38555e+06 9.21269e+06 3.56174e+07
51848 20221021.16 11364.3 0 43358.9 0 5658.82 8.32349e+07 10138.2 0 4456.01 0 17703.3 1.6126e+07 3572.58 0 5981.75 1.53396e+07 3260.47 0 2352.14 9.57242e+06 1984.48 9.57242e+06 25142 1926.69 9.31027e+06 904527 1.37157e+06 9.22124e+06 3.55556e+07
51851 20221021.17 11176.3 0 44090.4 0 5729.32 8.29727e+07 10212 0 4263.98 0 17671.2 1.63882e+07 3493.24 0 6020.59 1.56017e+07 3218 0 2360.35 9.57242e+06 1987.43 9.57242e+06 21840.1 1914.63 9.31027e+06 889539 1.38107e+06 9.39445e+06 3.58663e+07
51993 20221024.30 10975.4 0 40992.4 0 5601.91 8.40213e+07 10010.2 0 4349.52 0 17620.9 1.6126e+07 3464.4 0 6029.57 1.53396e+07 3218.13 0 2361.91 9.57242e+06 1983.84 9.57242e+06 25266.4 1913.11 9.04813e+06 881347 1.37136e+06 9.3601e+06 3.58663e+07
52002 20221024.34 11265.9 0 43190.2 0 5604.41 8.29727e+07 10703 0 4307.4 0 17652.2 1.6126e+07 3413.27 0 6128.9 1.56017e+07 3231.6 0 2367.94 9.57242e+06 1984.36 9.57242e+06 26975.2 1928.18 9.04813e+06 877306 1.37338e+06 9.20441e+06 3.58669e+07

images

ccf-bot avatar Oct 06 '22 16:10 ccf-bot

Most are rename suggestions. For some context, when variable names are single/double lettered and (for example) are declared in line 1, one can quickly forget what that represents in line 20 or so. Sometimes F12 in VSCode also becomes quite tricky to do it on one or two lettered variables.

Otherwise, nice work on this change!

@MahatiC Thanks, I've renamed the short variables as suggested :)

eddyashton avatar Oct 21 '22 12:10 eddyashton

/azp run

eddyashton avatar Oct 24 '22 15:10 eddyashton

Azure Pipelines successfully started running 3 pipeline(s).

azure-pipelines[bot] avatar Oct 24 '22 15:10 azure-pipelines[bot]