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

Allow generic S3 endpoints for alternative services #4030

Merged
merged 4 commits into from
Dec 13, 2023

Conversation

ChimneySwift
Copy link
Contributor

Overview

This is a possible implementation for a previously mentioned feature (#3691, #3973), which is custom S3-compatible endpoints in order to allow the use of non-AWS block storage.

Many of these services offer significantly cheaper alternatives to AWS (with backblaze being almost 4x cheaper).

I understand there was some work on this in the s3rework branch, but I was more interested in having something soon to see if my plan to use block storage is feasible, and this is potentially a good stop-gap until someone has the time to fully rework the s3 implementation.

I haven't performed much testing on this release, but it appears to work with Backblaze B2. I had some issues trying to get it to work with Cloudflare R2, but I'm not sure if this is more of a Cloudflare-related issue.

Changes

The main blocker for implementing this is the lack of custom endpoint support within the s3-lite version dynmap uses. There is a new version, 0.0.2-SNAPSHOT, which does support custom endpoint URLs and is a mostly drop-in replacement. Though it's not an official release, there has been no movement on that repo for about a year, so that's as good as it gets without a rewrite.

Anyway, in order to implement this I updated the s3-lite package to 0.0.2-SNAPSHOT and I have added an override_endpoint option to manually set the S3 endpoint. If override_endpoint is blank (the default), it is assumed AWS S3 is being used, and the endpoint is derived from the region.

I have released jars for this version on my fork for anyone interested in testing. I have only tested spigot on 1.20.2 thus far.

I have also cloned the wiki onto my fork, and have updated the AWS S3 page to include documentation for third-party providers.

@mikeprimm
Copy link
Member

This looks promising - I'll give it a proper review this weekend, and merge if it looks good. I am not set up to confirm this in any meaningful way, and am not planning on spending money to do so, so other than making sure this doesn't break the AWS S3 (which I use routinely for work), this will be otherwise untested.

@ChimneySwift
Copy link
Contributor Author

Sounds good, this was mainly so I could test some options before pursuing further, but it does seem to work. As long as it doesn't break AWS S3, I don't see a reason not to merge.

I'm not sure I will personally end up using it, not every S3-like service is really geared toward hosting map tiles with frequent gets. I've just got Bunny CDN set up which is working really well (fast and you can replicate in multiple regions for low latency around the world) but unfortunately it's not S3 compatible. At the moment I have a custom python script syncing the tiles up to bunny, but if I want to use this long term I might consider integrating directly into dynmap, even if only for a personal fork.

An interesting note is that the current S3 implementation is more trying to solve storage constraints, however it could also help bandwidth constrained users, and maybe even help improve performance depending on the service. This can be done by pushing tiles to a CDN and then setting the url.tiles setting to point to the CDN instead of the server. The website (and dynmap_world.json) is then served from the server, while the tiles are served from the CDN.

@obsd-guru
Copy link

thanks for adding this feature. was looking for it already. if you need some beta testing pls let me know. i am planning to use it with a minio s3 backend.

@mikeprimm mikeprimm merged commit b0e56d3 into webbukkit:v3.0 Dec 13, 2023
@mikeprimm
Copy link
Member

Merging this - will see how it goes!

stewi1014 added a commit to stewi1014/dynmap that referenced this pull request Oct 25, 2024
This solution is no ideal because it breaks s3 providers that are not amazon. The real fix for this is to replace this s3 library.

This reverts commit b0e56d3, reversing
changes made to 20700c2.
stewi1014 added a commit to stewi1014/dynmap that referenced this pull request Oct 28, 2024
This reverts commit b0e56d3, reversing
changes made to 20700c2.

The reason for reverting this is that it breaks zoom tile generation for Amazon's s3 in an insidious way.
No errors are reported, and the zoom tile thread infinitely iterates over calling the s3 API,
throwing an error when s3 replies and then swallowing the error and immediately trying again.
This generates about 2-3MB/s of useless traffic to s3 and the immense amount of API calls made incurs a significant cost.
stewi1014 added a commit to stewi1014/dynmap that referenced this pull request Oct 30, 2024
This reverts commit b0e56d3, reversing
changes made to 20700c2.

The reason for reverting this is that it breaks zoom tile generation for Amazon's s3 in an insidious way.
No errors are reported, and the zoom tile thread infinitely iterates over calling the s3 API,
throwing an error when s3 replies and then swallowing the error and immediately trying again.
This generates about 2-3MB/s of useless traffic to s3 and the immense amount of API calls made incurs a significant cost.
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