Last active
May 13, 2024 14:15
-
-
Save Akeboshiwind/5c2b4c96240431f29eb97f85d7016adb to your computer and use it in GitHub Desktop.
POST large file to xtdb v2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run the docker container w/ /tmp/xtdb-data-dir as the data folder | |
docker run --pull=always -tip 6543:3000 -v /tmp/xtdb-data-dir:/var/lib/xtdb ghcr.io/xtdb/xtdb-standalone-ea | |
# Verify the initial size: | |
du -h /tmp/xtdb-data-dir | |
# (should be 0B) | |
# Construct a large input file (around 1MB) | |
echo -n '{"txOps":[{"putDocs":[{"xt/id":1,"doc":"' > /tmp/file | |
dd if=/dev/urandom bs=786438 count=1 | base64 >> /tmp/file | |
echo -n '"}],"into":"docs"}]}' >> /tmp/file | |
# POST the large file 10 times | |
for run in {1..10}; do curl -X POST -H "Content-Type: application/json" -d @/tmp/file http://localhost:6543/tx; done | |
# Check again | |
du -h /tmp/xtdb-data-dir | |
# (should be around 10MB) | |
# POST updates to the same doc | |
for run in {1..10}; do curl -X POST -H "Content-Type: application/json" -d '{"txOps":[{"sql":"UPDATE docs SET price = 340 WHERE docs.xt$id = 1"}]}' http://localhost:6543/tx; done | |
# Check again | |
du -h /tmp/xtdb-data-dir | |
# (should still be around 10MB) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment