Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Issue #3840 Static resource byte-range support performance #3910

Merged
merged 9 commits into from Jul 31, 2019

Conversation

joakime
Copy link
Contributor

@joakime joakime commented Jul 26, 2019

  • Reverting toFile().getInputStream() on PathResource
  • Adding RangeWriter concept for managing open resource across multiple range writes
  • RangeWriter implementation delegates to HttpContent behaviors (will use Cached version, or not, depending on prior ContentFactory behavior)
    Lookup is :
    • Direct Buffer
    • Indirect Buffer
    • ReadableByteChannel (as SeekableByteChannel)
    • InputStream
  • Adding unit tests for all RangeWriter implementation to ensure that they behave the same way everywhere.
  • Making ResourceService use new RangeWriter implementation
  • Existing DefaultServletRangeTest still works as-is

Signed-off-by: Joakim Erdfelt joakim.erdfelt@gmail.com

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
+ Reverting toFile().getInputStream() on PathResource
+ Adding RangeWriter concept for managing open resource
  across multiple range writes
+ RangeWriter implementation delegates to HttpContent behaviors
  Lookup is :
  - Direct Buffer
  - Indirect Buffer
  - ReadableByteChannel (as SeekableByteChannel)
  - InputStream
+ Adding unit tests for all RangeWriter implementation to ensure
  that they behave the same way everywhere.
+ Making ResourceService use new RangeWriter implementation
+ Existing DefaultServletRangeTest still works as-is

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
@joakime joakime requested a review from gregw July 26, 2019 17:44
@joakime
Copy link
Contributor Author

joakime commented Jul 26, 2019

The implementation and test case are complete.

I'm working on collecting some numbers from tests on 9.2.28.v20190418 (which still had FileResource as default), 9.4.19, and this branch.

+ SPARSE hint only applies to real os file systems or
  default file systems, not for all file systems.

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
Copy link
Contributor

@gregw gregw left a comment

Choose a reason for hiding this comment

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

This is mostly LGTM... modulo my caution about making this change in a dot release... but I can be convinced. Just a few quibbles.

+ break out if progress isn't made, loop if not enough
  progress is made

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
+ Construction of PathResource now tests if path belongs
  to the Default FileSystem or not.  This important info
  for later actions against the PathResource that would
  need to know the File object for the Path object.
  Non-Default FileSystem == null
  Default FileSystem == Path.toFile()

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
+ Reset progress on any positive skip value
+ Throw IOException(EOF) for any negative skip value

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
+ Using techniques from SeekableByteChannelRangeWriter
  with variant for -1 count parameter

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
+ Removing unnecessary variables (per PR review)

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
@joakime joakime requested a review from gregw July 30, 2019 22:13
@joakime
Copy link
Contributor Author

joakime commented Jul 30, 2019

@gregw you'll want to review the extra 3 commits since your approval.

Copy link
Contributor

@gregw gregw left a comment

Choose a reason for hiding this comment

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

one little niggle...

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
@joakime joakime merged commit 95298d8 into jetty-9.4.x Jul 31, 2019
@joakime joakime deleted the jetty-9.4.x-3840-pathresource-byterange branch July 31, 2019 01:04
@joakime joakime added this to Done in Jetty 9.4.20 Jul 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Jetty 9.4.20
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants