Skip to content

Batch API: upper limit of the number of objects per batch #419

Closed

Description

@technoweenie

The current implementation of the batch api client code in v0.5.2 scans the commits for all Git LFS objects, and then sends them all in a single POST to /objects/batch. A reasonable limit on the number of objects per post would relieve the server from having to worry about a potentially massive in-memory hash parsed from JSON. This limit should be mentioned in the API specs so servers can implement the limit as well.

My hunch is that 100 is a good starting point.

Activity

  1. michael-k commented on Jun 19, 2015

    @michael-k
    Contributor

    👍
    We should make it configurable.

    • Easier to provide support if somebody runs into problems with 100 being to high.
    • Servers can be tested, benchmarked, … without changing the client's code.
  2. technoweenie commented on Jun 19, 2015

    @technoweenie
    ContributorAuthor

    Making it configurable is fine, but it could cause problems if there's a mismatch between the configured client and various servers.

  3. michael-k commented on Jun 20, 2015

    @michael-k
    Contributor

    We could define a upper bound for the upper limit to restrict it to values <= 100. This way it's possible to let users lower the upper limit without putting to much stress on the server. My intention with “making it configurable” was to let users define lower upper limits than any constant in the client's code.

    A reasonable limit on the number of objects per post would relieve the server from having to worry about a potentially massive in-memory hash parsed from JSON. This limit should be mentioned in the API specs so servers can implement the limit as well.

    A malicious client could still send whatever it wants. Would it be possible for servers to reject POST requests with an “to many objects” error? (I'm not familiar enough with the current batch API.)

  4. technoweenie commented on Jun 22, 2015

    @technoweenie
    ContributorAuthor

    A malicious client could still send whatever it wants. Would it be possible for servers to reject POST requests with an “to many objects” error? (I'm not familiar enough with the current batch API.)

    Yeah, they can return that with a 400 or 422 status. Web servers like nginx will also have some lower level setting to restrict the body size.

  5. technoweenie commented on Jun 22, 2015

    @technoweenie
    ContributorAuthor

    Related: we should also strip objects that are already in .git/lfs/objects: #430

  6. technoweenie commented on Jul 27, 2015

    @technoweenie
    ContributorAuthor

    Starting with #476, we're rolling with 100 for the initial batch size. This could definitely change depending on our benchmarking results with the new server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions