{"id":14446737,"url":"https://github.com/sebyx07/s3-light","last_synced_at":"2025-10-31T11:30:33.700Z","repository":{"id":253862083,"uuid":"844812554","full_name":"sebyx07/s3-light","owner":"sebyx07","description":"S3 client for ruby","archived":false,"fork":false,"pushed_at":"2024-08-20T02:52:27.000Z","size":69,"stargazers_count":12,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-29T08:41:39.803Z","etag":null,"topics":["rails","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sebyx07.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-20T02:43:40.000Z","updated_at":"2024-12-06T15:26:59.000Z","dependencies_parsed_at":"2024-08-20T03:30:14.795Z","dependency_job_id":null,"html_url":"https://github.com/sebyx07/s3-light","commit_stats":null,"previous_names":["sebyx07/s3-light"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sebyx07%2Fs3-light","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sebyx07%2Fs3-light/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sebyx07%2Fs3-light/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sebyx07%2Fs3-light/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sebyx07","download_url":"https://codeload.github.com/sebyx07/s3-light/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238821445,"owners_count":19536223,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["rails","ruby"],"created_at":"2024-09-01T07:01:05.570Z","updated_at":"2025-10-31T11:30:33.627Z","avatar_url":"https://github.com/sebyx07.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"# S3::Light 🚀\n\nS3::Light is a fast, lightweight Ruby gem for interacting with S3-compatible storage services. It's designed to be simple, efficient, and powerful! 💪\n\n## Features 🌟\n\n- 🚄 Lightning-fast performance\n- 🪶 Lightweight design\n- 🔧 Easy to use and integrate\n- 📦 Batch operations support\n- 🔄 Concurrent processing\n- 🔌 Compatible with S3 and S3-like services (e.g., MinIO)\n- 🔁 Connection reuse and keep-alive\n- 🧵 Thread-safe connection management\n\n## Installation 📥\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 's3-light'\n```\n\nAnd then execute:\n\n    $ bundle install\n\nOr install it yourself as:\n\n    $ gem install s3-light\n\n## Usage 🛠️\n\n### Basic Operations\n\n```ruby\n# Initialize the client\nclient = S3Light::Client.new(\n  access_key_id: 'your_access_key',\n  secret_access_key: 'your_secret_key',\n  region: 'us-east-1',\n  endpoint: 'http://localhost:9000'  # For MinIO, use the MinIO server URL\n)\n\n# List all buckets\nbuckets = client.buckets.all\n\n# Create a new bucket\nnew_bucket = client.buckets.new(name: 'my-awesome-bucket').save!\n\n# Upload an object\nobject = new_bucket.objects.new(key: 'hello.txt', input: 'Hello, World!').save!\n\n# Download an object\ndownloaded_content = object.download(to: '/tmp/hello.txt')\n\n# Delete an object\nobject.destroy!\n\n# Delete a bucket\nnew_bucket.destroy!\n```\n\n### Batch Operations 🎛️\n\nS3::Light shines when it comes to batch operations! Here are some examples:\n\n```ruby\n# Create multiple buckets at once\nnew_buckets = client.buckets.create_batch(names: ['bucket1', 'bucket2', 'bucket3'])\n\n# Check if multiple buckets exist\nexistence = client.buckets.exists_batch?(names: ['bucket1', 'bucket2', 'nonexistent-bucket'])\n\n# Upload multiple objects concurrently\nbucket = client.buckets.find_by(name: 'my-bucket')\nobjects = bucket.objects.create_batch(\n  input: {\n    'file1.txt' =\u003e 'Content 1',\n    'file2.txt' =\u003e 'Content 2',\n    'file3.txt' =\u003e File.open('path/to/file3.txt')\n  },\n  concurrency: 5\n)\n\n# Download multiple objects concurrently\ndownloads = bucket.objects.download_batch(\n  keys: ['file1.txt', 'file2.txt', 'file3.txt'],\n  to: '/tmp',\n  concurrency: 5\n)\n```\n\n## Performance Benchmarks 📊\n\nWe've conducted benchmarks comparing S3::Light with the Amazon S3 gem. The benchmark tests include uploading and downloading a 50MB file 50 times individually.\n\nHere's a summary of the benchmark results:\n\n| Operation         | S3::Light | Amazon S3 Gem | Performance Difference |\n|-------------------|-----------|---------------|------------------------|\n| Individual Upload | 22.56s    | 37.98s        | 41% faster             |\n| Individual Download | 27.24s  | 28.38s        | 4% faster              |\n\nThese results demonstrate that S3::Light offers significant performance improvements for individual upload operations and is slightly faster for individual downloads.\n\nS3::Light shows its strength in:\n- Individual file uploads (41% faster)\n- Individual file downloads (4% faster)\n\nIt's important to note that performance can vary depending on factors such as network conditions, server load, and specific use cases. We recommend running benchmarks in your own environment to get the most accurate results for your specific use case.\n\n### Key Observations:\n\n1. **Individual Uploads**: S3::Light significantly outperforms the Amazon S3 gem, completing the task in about 59% of the time taken by the Amazon S3 gem.\n\n2. **Individual Downloads**: S3::Light is slightly faster than the Amazon S3 gem, with a small but noticeable performance advantage.\n\nThese results highlight S3::Light's efficiency in handling individual file operations, particularly uploads, which could be beneficial for applications that frequently deal with single-file transfers.\n\nYou can find the full benchmark script in the `benchmark` directory of this repository. Feel free to run it yourself and compare the results in your specific environment.\n\n### Connection Reuse and Keep-Alive 🔁\n\nS3::Light implements connection reuse and keep-alive strategies to minimize the overhead of establishing new connections for each request. This significantly reduces latency, especially for applications that make frequent API calls.\n\n```ruby\n# The client automatically reuses connections\nclient.buckets.all  # First request establishes a connection\nclient.buckets.all  # Subsequent requests reuse the same connection\n```\n\n### Connection Pooling 🏊\n\nFor concurrent operations, S3::Light uses a connection pool. This allows multiple threads to work simultaneously without the overhead of creating new connections for each thread.\n\n```ruby\n# Connection pooling is automatically used in batch operations\nbucket.objects.download_batch(keys: large_list_of_keys, concurrency: 10)\n```\n\n### Thread-Safe Connection Management 🧵\n\nS3::Light ensures thread-safe connection management, allowing you to use it safely in multi-threaded environments without worrying about race conditions or data corruption.\n\n### Efficient Batch Processing 📦\n\nBatch operations in S3::Light are designed to maximize throughput by processing multiple items concurrently while efficiently managing resources.\n\n## Best Practices 🏆\n\nTo get the most out of S3::Light's performance features:\n\n1. Reuse client instances when possible to take advantage of connection reuse.\n2. Use batch operations for handling multiple items instead of processing them one by one.\n3. Experiment with the `concurrency` parameter in batch operations to find the optimal setting for your use case and infrastructure.\n4. Remember to call `S3Light::Client.close_all_connections` when your application is shutting down to properly release all resources.\n\n## Development 🛠️\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`.\n\n## Contributing 🤝\n\nBug reports and pull requests are welcome on GitHub at https://github.com/sebyx07/s3-light. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/sebyx07/s3-light/blob/master/CODE_OF_CONDUCT.md).\n\n## License 📄\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n## Code of Conduct 🤓\n\nEveryone interacting in the S3::Light project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/sebyx07/s3-light/blob/master/CODE_OF_CONDUCT.md).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsebyx07%2Fs3-light","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsebyx07%2Fs3-light","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsebyx07%2Fs3-light/lists"}