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
Performance: Sync only new files? #116
Comments
@ChrisHughes hey, this feature is accomplished by #110 Check it out using the asset_sync#turbosprockets branch and the I would class this as experimental as it is a backport of upcoming Rails 4 functionality. |
@davidjrice - I'm not sure that @ChrisHughes was talking about maintaining a local index of uploaded files, so that you don't need to keep requesting the directory listing from the server. It could be done with a new file at I'm not too familiar with S3 or asset_sync, but isn't the directory listing only fetched once per run? If so, that shouldn't take much time, and is nothing to worry about since the compilation bottleneck is fixed by the |
P.S. It turns out that |
Okay, reopening. @ndbroadbent yes, listing is only fetched once per run. @ChrisHughes did you try turbosprockets? improvement? Also, @ChrisHughes how come you have so many assets! Understanding the source of the problem might help with further solution. Regarding keeping track of what files have been uploaded by asset_sync, I get it! However it's not something I would be interested in implementing... as we don't have that problem. Maintaining a list of files that have been uploaded would infer that the assets must be generated locally and uploaded, an asset_sync uploads file generated and committed. The benefit of asset_sync is that we do not have to version control bundled assets, or any other files relating to such. We just |
@davidjrice I did try using turbosprockets, gave a very small improvement in speed. Compile time isn't the issue as I have timed that versus the syncing part. The reason we have so many files is that we have an app with > 150 themes, compiled at ~ 20 mobile screen resolutions to ensure the designs are looking correct on every iOS / android phone out there. Not much I can do about the number of files unfortunately, it's already fully optimized. |
We are in the same situation with 500+ themes - using themes_for_rails gem. The no. of files are even more in our case, using turbosprockets-rails-3 gem - giving stack level too deep error. Even increasing ulimit didn't help either. Anyways of reducing the pre-compile time and syncing only the changed files to S3? |
We could not do much to improve it, but we found that the directory listing (i.e. reading what existing files are in the S3 bucket) was very slow, also uploading already existing files can be avoided. So extended the AssetSync::Storage.upload_files function to cache the directory listing (i.e. list of synced files) on a local drive. Then, as each are hashed based on content, only upload the files that are modified. Here is a working example: https://gist.github.com/ChrisHughes/f89a48743c99e135f285 |
this is still prevalent in 2020... If you add webpacker, it uploads all files again, even when they are already existing.. |
The new |
We have similar case, were we build using AWS Codebuild, pre-compilation takes about 20 minutes each time, any advice is appreciated. |
On our rails project that has about 3000 images and 3000 scss files the asset sync time takes over 20 minutes to go up to Amazon S3.
We currently only upload the md5 tagged files.
I'd really like a feature that only uploads the files with md5 tags that are different (i.e. filename not present in last sync). For example every time a file is successfully uploaded, it logs that filename so that it doesn't have to keep checking the server for the presence of a file or reupload the same file. If we can skip directory listing and uploading unnecessary files this would speed up this process to a matter of minutes.
The text was updated successfully, but these errors were encountered: