Commit Graph

62 Commits

Author SHA1 Message Date
Geoff Kizer efa0a48fb1 Add initial Socket transport for Kestrel (#1659)
- This change adds the initial socket transport for Kestrel, all of the tests pass but there are still
a couple of things that aren't done yet.
- The functional tests support running both on both transports but tests aren't running for sockets right now. We need to parameterize these. 
- TimeoutServerTests hard code the libuv transport, this needs to support any transport.
- There is no handling of connection stopping on application shutdown. This is being implemented in kestrel core so transports don't need to handle it. Sockets won't be the default transport until that is the case.
- Performance needs to be looked at, today the SocketTransport doesn't dispatch by default and we're not buffering in kestrel.core, this can hurt as the number of kernel calls map 1:1 with application writes.
2017-04-13 23:10:06 -07:00
Stephen Halter 11ab602b2f Make timeout logic transport agnostic (#1649)
* Make timeout logic transport agnostic

* PR feedback

* More PR feedback
2017-04-12 16:15:46 -07:00
Ben Adams d29e4d4cf0 Specialized struct generics rather than interface (#1640)
Changed the IHttpParser interface to be generic. This lets use a struct to 
get better code generation and also should allow us to inline calls back into
the handler from the parser.
2017-04-10 19:30:18 -07:00
Ben Adams 2863cca8ca FrameFeatureCollection benchmark (#1643) 2017-04-09 16:02:18 -07:00
Pavel Krymets 53b0eea2ec Use writable buffer writer (#1564) 2017-04-07 14:40:10 -07:00
David Fowler 239b691ff5 A few HttpParser changes (#1624)
- Renamed KestrelHttpParser to HttpParser
- Removed the generic virtual dispatch as it turns out to be an
order of magnitude slower than regular virtual dispatch. This change
means we also lose the inlining of Frame.OnStartLine and Frame.OnHeader.
2017-04-07 08:35:53 -07:00
Cesar Blum Silveira f253dbc0c0 Split transport-specific tests and general tests into distinct test projects (#1588).
* Rename EngineTests to LibuvTransportTests.
* Move libuv-specific tests into their own test project.
* Move LibuvOutputConsumerTests.AllocCommitCanBeCalledAfterConnectionClose to new OutputProducerTests class and rename it to WritesNoopAfterConnectionCloses.
* Remove TransportContext from TestServiceContext.
* Make KestrelTests depend on Kestrel.Core only.
* Rename Microsoft.AspNetCore.Server.Kestrel.KestrelTests to Microsoft.AspNetCore.Server.Kestrel.Core.Tests.
* Add Microsoft.AspNetCore.Server.Kestrel.Tests test project for WebHostBuilderKestrelExtensionsTests.
* Increase socket receive timeout in MaxRequestBufferSizeTests to mitigate flakiness.
* Anything using TestServer should be a functional test.
* Move out of LibuvTransportTests tests that are not specific to LibuvTransport.
  - Move to RequestTests:
    - Http11 (rename to Http11KeptAliveByDefault)
    - Http10ContentLength (rename to Http10NotKeptAliveByDefault)
    - Http10KeepAlive
    - Http10KeepAliveNotUsedIfResponseContentLengthNotSet (rename to Http10KeepAliveNotHonoredIfResponseContentLengthNotSet)
    - Http10ContentLengthKeepAlive (rename to Http10KeepAliveHonoredIfResponseContentLengthSet)
    - Expect100ContinueForBody (rename to Expect100ContinueHonored)
    - ZeroContentLengthAssumedOnNonKeepAliveRequestsWithoutContentLengthOrTransferEncodingHeader
    - ConnectionClosesWhenFinReceivedBeforeRequestCompletes (test was actually not marked as Theory, and was incorrect)
    - RequestsCanBeAbortedMidRead
    - RequestHeadersAreResetOnEachRequest
    - UpgradeRequestIsNotKeptAliveOrChunked
    - HeadersAndStreamsAreReused (rename to HeadersAndStreamsAreReusedAcrossRequests)
  - Move to ResponseTests:
    - Http10RequestReceivesHttp11Response (rename to Http11ResponseSentToHttp10Request)
    - ZeroContentLengthSetAutomaticallyAfterNoWrites
    - ZeroContentLengthSetAutomaticallyForNonKeepAliveRequests
    - ZeroContentLengthNotSetAutomaticallyForHeadRequests
    - ZeroContentLengthNotSetAutomaticallyForCertainStatusCodes
    - ConnectionClosedAfter101Response
    - ThrowingResultsIn500Response
    - ThrowingAfterWritingKillsConnection
    - ThrowingAfterPartialWriteKillsConnection
    - ThrowingInOnStartingResultsInFailedWritesAnd500Response
    - ThrowingInOnCompletedIsLoggedAndClosesConnection
    - FailedWritesResultInAbortedRequest
    - NoErrorsLoggedWhenServerEndsConnectionBeforeClient
    - NoResponseSentWhenConnectionIsClosedByServerBeforeClientFinishesSendingRequest
    - ResponseHeadersAreResetOnEachRequest
    - OnStartingCallbacksAreCalledInLastInFirstOutOrder
    - OnCompletedCallbacksAreCalledInLastInFirstOutOrder
  - Remove:
    - RePathEscapeTests (theory data to HttpParsingData)
    - ReDisconnectingClient (what was that testing?)
2017-04-06 19:09:40 -07:00
Pavel Krymets dd02ba577f Use corefxlab and corefx by source (#1612) 2017-04-05 15:37:45 -07:00
David Fowler bab4332a47 Add benchmark that drains the buffer without going through the pipe (#1611) 2017-04-05 10:09:43 -07:00
Stephen Halter b40d8b4248 Fix naming of IConnectionInformation.OutputReaderScheduler (#1608) 2017-04-04 21:30:33 -07:00
Cesar Blum Silveira 7ceea5323a Rename namespaces/directories/classes in Kestrel.Core and Transport.Libuv (#1582).
- Put everything in the libuv transport package under `Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.*` namespaces.
- Move stuff in Transport.Libuv/Internal/Http and Transport.Libuv/Internal/Infrastructure to Transport.Libuv/Internal (keep the Networking directory for the libuv wrappers).
- Add `Libuv` prefix to most libuv internal classes.
- Rename `KestrelEngine` to `LibuvTransport`.
- Rename `SocketOutputConsumer` to `LibuvOutputConsumer`.
- Rename `SocketOutputProducer` to `OutputProducer`.
- Fix namespaces in `Microsoft.AspNetCore.Server.Kestrel.Core.`
2017-04-04 13:45:02 -07:00
Pavel Krymets fd5f3a771c React to corefxlab changes (#1602) 2017-04-03 20:20:39 -07:00
Cesar Blum Silveira 6bd0344880 Add Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions project (#1582).
- Changes the design to have one ConnectionHandler per endpoint.
2017-04-03 15:09:03 -07:00
Pavel Krymets c7113e1c60 Revert "Fetch corefx lab sources and compile them into kestrel (#1581)"
This reverts commit 13ee32b7ab.
2017-04-03 14:08:27 -07:00
Pavel Krymets 13ee32b7ab Fetch corefx lab sources and compile them into kestrel (#1581) 2017-04-03 13:21:17 -07:00
Nate McMaster 83958886cc
Implement IHttpRequestIdentifierFeature on Frame
This feature generates a unique ID per request. This unique ID can be
used in event source and logging.

Also, this change improves KestrelEventSource by moving it back into the
Kestrel.Core assembly and de-coupling from the Libuv transport. This
adds two new events, RequestStart and RequestStop, which can be used to
identify the correlation between connection ID and request trace
identifier.
2017-03-31 16:54:35 -07:00
Ryan Nowak 0ab49f4977 Fix benchmarks on netcoreapp2.0 2017-03-31 10:39:55 -07:00
David Fowler 1bf9b057d4 Converted test projects to run on netcoreapp2.0
* Converted test projects to run on netcoreapp2.0
* Set DOTNET_RUNTME_ID because of an issue in corehost and RID calculation.
2017-03-31 02:58:18 -07:00
Stephen Halter 7f785588ef Transport agnostic kestrel refactoring (#1551)
- Add transport interfaces
- Create separate Core and Libuv projects

#828
2017-03-29 16:06:05 -07:00
Ben Adams ff99c4c865 Fix benchmarks (broken) (#1515)
* Fix benchmarks
* Remove Moq from benchmarks
2017-03-22 18:30:06 -07:00
Stephen Halter 8923b0da70 Use correct config for response buffer limit (#1516) 2017-03-20 15:43:55 -07:00
David Fowler 2ed456fd68 Faster Write implementation using cpblk (#1511)
* Faster Write implementation
- Use Unsafe.CopyBlockUnaligned to copy bytes to the
WritableBuffer. This is temporary until we get newer
corefx bits with a better span.CopyTo implementation.
- Remove WritableBufferExtensions from Performance project
- Split method into WriteFast and WriteMultiBuffer
- Cache the span for the common case where
the buffer is non empty.
- Use ref locals instead of pinning pointers in fast path
2017-03-19 12:44:01 -07:00
David Fowler 1094cc0670 Use StreamSocketOutput for writing benchmarks (#1507)
- Use StreamSocketOutput with a null stream to get a
better picture of what actual performance looks like
2017-03-18 13:20:07 -07:00
Ben Adams 5b814a55ac Speed up WritableBuffer.WriteXxx (#1504)
* Speed up WritableBuffer.WriteAscii
* Add Benchmarks
* Non-standard header vals are still ascii
* Speedup WriteNumeric
* Don't advance for write
* Remove cruft
2017-03-18 12:25:10 -07:00
Pavel Krymets 07cbf7faa9 Use pipelines for SocketOutput
- Changed socket output to be based on pipelines
- Changed connection filter glue to be based on pipelines
- Codegen that used `MemoryPoolIterator` for output now uses `WritableBuffer`
- Made `UvWriteReq` async/await friendly with `LibuvAwaitable<T>`
- Deleted MemoryPool and friends
2017-03-18 00:26:00 -07:00
Cesar Blum Silveira 2ef3804578 Span-based RemoveDotSegments (#1448) 2017-03-17 14:42:13 -07:00
Nate McMaster 5073d4fdaf Re-add .NET Framework to tests and other cleanup (#1494) 2017-03-14 11:02:49 -07:00
David Fowler 5644310811 Clean up benchmarks (#1487)
- Benchmarks are suffixed with *Benchmarks
- Removed Custom RpsColumn.cs and used Ops/Second column
- Removed params from RequestParsingBenchmark
2017-03-12 22:52:24 -07:00
Cesar Blum Silveira 49f09d5a25 Log rejected request targets. 2017-03-12 18:37:08 -07:00
David Fowler f479720d5a Remove our custom bootstrapper and use the BenchmarkSwitcher (#1480) 2017-03-11 18:19:13 -08:00
Ben Adams 3c8ee39f1d Fxi writing perf test (#1478) 2017-03-10 12:04:28 -08:00
Nate McMaster 49b328d4c2 Handle absolute, asterisk, and authority-form request targets
Improves compliance with RFC 7230 on the expected handling of requests
that have URI or asterisk in the request target.

This means rejecting asterisk requests that are not OPTIONS and rejecting
authority-form requests taht are not CONNECT.

This also means the server will handle the path and query on targets
with absolute URIs as request-targets.
2017-03-09 16:54:12 -08:00
Ben Adams 941d396942 Speed up ParseRequestLine (#1463) 2017-03-08 19:27:56 -08:00
Nate McMaster 63e3c9428a You can't have two benchmarks as the baseline. 2017-03-08 17:28:13 -08:00
Nate McMaster 3a1f3d14f9 Add absolute-uri benchmark and change plaintext, live aspnet, and unicode benchmarks to use origin-form 2017-03-08 17:21:21 -08:00
David Fowler 13519b6079 Fix CopyTo implementation in benchmark. (#1462)
* wip

* ooops
2017-03-07 17:39:56 -08:00
Cesar Blum Silveira 0404bcc58c Add more microbenchmarks. 2017-03-06 10:14:22 -08:00
David Fowler 0ce111d9f1 Fix write size in benchmark (#1449) 2017-03-06 03:31:45 -08:00
Cesar Blum Silveira 83edc38e72 Use TechEmpower request as baseline for request parsing benchmarks. 2017-03-03 15:55:07 -08:00
Cesar Blum Silveira de2c3d3608 Merge branch 'KrzysztofCwalina/NewBenchmark' into dev 2017-03-03 15:28:34 -08:00
Stephen Halter ac60f13312 Modify RequestProcessingAsync to call single parse method (#1427)
* Modify RequestProcessingAsync to call single parse method
* Fix bad request logging
2017-03-03 14:43:32 -08:00
Krzysztof Cwalina 7cc5c537a4 Added a new benchmark 2017-03-03 13:13:11 -08:00
David Fowler 4d7c6ff69f use rtm appveyor 2017-03-02 21:44:36 -08:00
David Fowler 8929b40527 Single span optimizations (#1421)
- Added a fast path for single span in the start line parsing
- Added a fast path for single span header parsing
- Changed the out header loop to be pointer based (instead of slicing)
2017-03-02 12:17:39 -08:00
Ben Adams 40ee51846c Add allocations column (#1422) 2017-03-02 06:56:05 -08:00
David Fowler cb6059c143 Make the IHttpParser per frame and add a reset (#1415)
* Make the IHttpParser per frame and add a reset
- Made the IHttpParser a per frame object so state can be stored
across method calls and parses.
- Added HttpParserFactory to ServiceContext
2017-03-01 13:12:03 -08:00
Pavel Krymets d3694f085a Add IHttpParser interface (#1414) 2017-03-01 11:55:36 -08:00
Krzysztof Cwalina c56de066d3 Optimized parsing GET verb and version (#1399)
* Optimized parsing GET verb
* optimized http version parsing
* Added microbenchmarks for GetKnownMethod and GetKnownVersion
2017-02-28 17:02:52 -08:00
Cesar Blum Silveira 0dca3a266f Remove custom BenchmarkDotNet toolchain. 2017-02-21 12:05:16 -08:00
Pavel Krymets 824ef2c937 Input Pipeline migration (#1277) 2017-02-17 15:38:13 -08:00