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

Make the request body limit configurable (and increase the default) #1762

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

hannahbast
Copy link
Member

@hannahbast hannahbast commented Feb 4, 2025

There is now a runtime parameter request-body-limit with a default size of 100 MB. Previously, the implicit limit of Boost's http::request was used, which was 1 MB. When sending large requests via curl use a call like this:

curl -s localhost:7001 -H "Authorization: Bearer bla" -H "Content-type: application/sparql-update" --data-binary @file_with_insert_data > update-result.json

Sending an INSERT DATA currently takes around 40 second per one million triples, which is rather slow because the triples are parsed using the SPARQL parser. They should rather be parser with our RDF parser, which is work for a separate PR. See also #1756 (comment)

@hannahbast hannahbast changed the title Request size limit HOW TO increase the request size limit Feb 4, 2025
Copy link

codecov bot commented Feb 4, 2025

Codecov Report

Attention: Patch coverage is 88.88889% with 1 line in your changes missing coverage. Please review.

Project coverage is 90.18%. Comparing base (dffbc2b) to head (ced8150).

Files with missing lines Patch % Lines
src/util/http/HttpServer.h 87.50% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1762      +/-   ##
==========================================
- Coverage   90.18%   90.18%   -0.01%     
==========================================
  Files         399      399              
  Lines       38374    38381       +7     
  Branches     4293     4294       +1     
==========================================
+ Hits        34608    34613       +5     
+ Misses       2473     2470       -3     
- Partials     1293     1298       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@RobinTF
Copy link
Collaborator

RobinTF commented Feb 5, 2025

@hannahbast This seems to be a duplicate of #1089

@@ -10,6 +10,7 @@
#include <future>

#include "absl/cleanup/cleanup.h"
#include "global/RuntimeParameters.h"
Copy link
Collaborator

Choose a reason for hiding this comment

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

This header is very expensive to include. It would be nice if the implementation could be moved into a cpp file

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for having a look. The HttpServer.h header is now only included in Server.cpp so that shouldn't be that much of a problem. The HttpServer unfortunately cannot be moved to a cpp, because the whole class is templated.

Copy link
Collaborator

Choose a reason for hiding this comment

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

That's fine too but I was thinking about adding a helper function in a cpp and using it to call the function indirectly

Copy link
Member Author

@hannahbast hannahbast left a comment

Choose a reason for hiding this comment

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

1-1 with Julian, we tested this quite a bit and it works. Some minor suggestions:

  1. Error handling when body limit is exceeded (right now the request does nothing and sends an empty reply)
  2. Increase the default limit from 1 MB to 100 MB
  3. Move the #include of util/http/HttpServer.h from Server.h to Server.cpp
  4. Abbreviate large updates in the returned JSON (this is probably a PR on its own)
  5. Fix copyright note at the top of HttpServer.h

@hannahbast hannahbast changed the title HOW TO increase the request size limit Make the request body limit configurable (and increase the default) Feb 21, 2025
@sparql-conformance
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants