I have uploading photos with ajax, manipulations and uploading to s3 take a lot of time. I heard that it's better to complete that tasks on background. My app need to wait while photos become uploaded. But if I choose background way then I will need to work with websockets or repeat ajax to check result(links to s3) ( I'm not happy about this). Why is it too bad to make hard calculations right in controller (foreground)? Now I use Torquebox(Jruby) and as I understand it has perfect concurrency. Does it mean that waiting uploading to s3 will not take resources and all will work fine? Please write about pros and cons of back/fore ground in my situation. Thank you!
Foreground or background image manipulations in Rails (Jruby, Torquebox)
144 views Asked by makrusak At
1
There are 1 answers
Related Questions in RUBY-ON-RAILS
- How to display legend box in tooltip text for amCharts 5 in Rails application?
- how to integrate cashfree payment gateway in ruby on rails project
- RSpec Capybara throwing Selenium error when trying to click a button with browser confirm
- rails minitest not picking up fixture properly, instance variable not percolating
- Duplicate GET requests - Rails & Heroku
- How to stub out current_user in JWT model for Rspec?
- NameError in Home#index
- Verifying Google Identity OAuth2 token with Ruby
- Error WebMock::NetConnectNotAllowedError in testing with stub using minitest in rails (using Faraday)
- why is mission_control-jobs erroring with load path error?
- Rescuing validation errors from a polymorphic association
- New error on random number assigned to local variable , Rails
- How to fix error in model with gem lockbox
- Images uploaded via Active Storage not displaying in Active Admin or on certain devices
- controller test_methods generating two errors intermittently
Related Questions in AMAZON-S3
- Mocking AmazonS3 listObjects function in scala
- S3 integration testing
- Error **net::ERR_CONNECTION_RESET** error while uploading files to AWS S3 using multipart upload and Pre-Signed URL
- Golang lambda upload image into s3 static website
- How to take first x seconds of Audio from a wav file read from AWS S3 as binary stream using Python?
- AWS Lambda Trigger For Same S3 File Name In Quick Succession
- Is there a way to upload a file in digital ocean object storage using php curl
- How to setup AWS credentials for next.js apps?
- S3 pre-signed url not working on whatsapp cloud Api
- How to set custom Origin Name in AWS CDK for CloudFront
- Property 'location' does not exist on type 'File'
- Resource handler returned message: "Unable to validate the following destination configurations
- Webmin CentOS7 AWS backup errors - perl(S3::AWSAuthConnection) can't be installed
- How to access variable to pass through url_for() as src in Flask App
- I cant figure out how to pull scripts from s3 to my aws workspace
Related Questions in JRUBY
- Error while doing bundle install with jruby
- jruby-jms-1.3.0-java gem create_destination method throws error "undefined method `java_kind_of?
- How to use csv converter encoding in ruby?
- Unable to run hbase shell in Mac
- Undefined method for nil:NilClass in JRuby
- Calling Java method doesn't work after upgrading jruby 9.2.11 to 9.3.0.0
- Form attribute :required => true missing from html output in production
- Intermittent connection refused error from Puma (Jruby version)
- OpenSSL error when installing JRuby with rbenv on MacOS
- JRuby can not call Java method
- Sanitizing encoding errors on input data in jruby
- JRuby ambiguous methods
- JRuby call Method from Java
- How to connect to SQLite3 database in JRuby?
- Extending (monkey patching) Java classes in Truffle Ruby
Related Questions in JRUBYONRAILS
- Error while doing bundle install with jruby
- jruby 9.3.4.0 NoMethodError: undefined method `new_ostruct_member' for No value for 'public' found
- what should be Ruby Safe navigator expression for account["details"]["name"]?
- No Route Matching in rails 6 for multiple route parameters
- direct upload using active storage in rails - input.dataset.directUploadUrl "undefined"
- Ruby Convert a Java Byte Buffer object to String
- Jruby version suitable for OpenJDK 8 (Zulu JDK)
- JRuby - query result is converted to String instead of Date
- How to pass changed values from text_field_tag to the controller
- make: *** No rule to make target '~/.rvm/rubies/jruby-9.2.0.0/lib/ruby/include/ruby/ruby.h', needed by 'amatch_ext.o'.
- How do I force warbler to use a specific version of jruby?
- JRuby Rails Console hanging on "Switch to inspect mode"
- NameError: uninitialized constant ActiveRecord::ConnectionAdapters::MysqlAdapter while starting rails server
- NoMethodError: undefined method `type_cast_config_to_integer' for ActiveRecord::ConnectionAdapters::Mysql2Adapter:Class
- Compiled Jruby application Instance variable error
Related Questions in TORQUEBOX
- X-Frame-Options on torquebox-server
- Torquebox setup on Ubuntu MaxPermSize
- Get 404 for Sinatra hello world app with Torquebox
- How to load a java class in torquebox at startup?
- Torquebox Jruby Rails Deploy
- Ruby on Rails 3: Streaming data and catching exception
- Torquebox LoadError - no such file to load -- torquebox/Service_registry
- java.lang.IllegalStateException: Database locked
- Foreground or background image manipulations in Rails (Jruby, Torquebox)
- How to handle uploads and logs in Rails when deployed as a .war file?
- Gem::LoadError: can't activate jruby-openssl-0.9.6-java, already activated jruby-openssl-0.9.5-java
- Torquebox: unable to work with SLIM
- JRuby 9k is not working with Puma and torquebox 4
- JRuby deployment options that support multiple versions of JRuby
- EC2 Bad Gateway with torquebox and nginx
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Popular Tags
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
It is generally considered bad practice to block a web request handler on a network request to a third party service. If that service should become slow or unavailable, this can clog up all your web processes, regardless of what ruby you are using. This is what you are referring to as 'foreground.'
Essentially this is the flow of your current setup (in foreground):
Clearly steps 3-5 are very bad news for your server, and as I stated earlier, this worker/thread/process (Depending on your ruby/rails server framework) will be 'held up' until the response from s3 is received (which potentially could never happen).
Here is the same flow with a background job with some javascript help on the front-end for notification:
now for the fun front end stuff:
I hope this sets you on the right path. I figured writing code for this answer was inferior because it seemed like you were looking for pros and cons. For actual implementation ideas, I would look into the following: