sucker_punch | Sucker Punch is a Ruby asynchronous processing library | Application Framework library
kandi X-RAY | sucker_punch Summary
kandi X-RAY | sucker_punch Summary
Sucker Punch is a Ruby asynchronous processing library using concurrent-ruby, heavily influenced by Sidekiq and girl_friday.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of sucker_punch
sucker_punch Key Features
sucker_punch Examples and Code Snippets
Community Discussions
Trending Discussions on sucker_punch
QUESTION
I have a Rails application which has 100% CPU utilization most of the time. I am not able to figure out why there is so much load on the server. I am using the Puma web server with a default configuration, and am running multiple background jobs using the sucker-punch gem. There are 7 files which are using sucker punch jobs with 5 workers:
...ANSWER
Answered 2018-Aug-29 at 04:40Your user space load is high (~48%), so you'll probably want to reduce the number of workers in your web application, increase the number of CPUs available on your instance, move to a version of Ruby that has better concurrency and real multi-core support (e.g. Rubinius or JRuby), or some combination of these options. Depending on what your code is actually doing, you may also need to re-architect your application to offload expensive I/O from the application server.
In addition, your steal time is quite high (~41%), so your EC2 instance is probably overloaded. Simply moving your application to a less-loaded instance may free up sufficient resources to reduce application wait times.
QUESTION
My AWS credits are expiring soon so I want to reduce the RAM use of my app to 512mb by stripping non-essential features and gems. So far, my remaining gems are:
...ANSWER
Answered 2019-Dec-15 at 02:48Is uglifier and sass-rails needed?
If you don't use sass on your project you can remove sass-rails. But I see you have font-awesome-sass gem.
Uglifier is used only when compiling assets so your css and js files are smaller.
The app has 200 tables. Will reducing the number of models and using .pluck on queries help reduce RAM use?
Rails autoloads your code, but I doubt the number of models has a significant impact on the ram usage. On the other hand, when you read a record from the database, rails has to create an ActiveRecord object on memory, if you have a table with hundreds of records and you just load all of them at once (User.all.to_a
or User.all.each
) it will require a lot of ram but only on that specific moment. Usually pluck
is a good way to use less ram since you only fetch an array of the values you want and not complete AR objects when you don't need them.
Will removing js dependencies such as mapbox and other css also reduce RAM use?
I don't think so, js dependencies are used during assets compilation.
A good trick to free some ram if you use multiple threads is to use jemalloc instead of the standard malloc for memory allocation https://www.youtube.com/watch?v=4_yxbh9Enoc
Another thing you can do is to only load the rails modules you actually use. On your config/application.rb file you'll see a line like this require 'rails/all'
that loads all rails features https://github.com/rails/rails/blob/master/railties/lib/rails/all.rb
You can change that line to only import the features you want, like if you don't use action_cable or active_job you can just import the rest.
Another thing you can do is remove gems related to third party js and css like bootstrap, font-awesome, jquery and use yarn to handle dependencies of js and css. You may lose some view helpers provided by those gems though.
QUESTION
I have a long running rake task that updates MLS data every night. The task first updates listing data, then after all the listings are updated, the pictures are loaded via Rails 5.2 activestorage. The listings get updated just fine over a period of 2-4 hours, but the picture loading will run for 10 to 30 minutes before failing with the same Rets::InvalidIdentifier: Got error code 20402 (Invalid Identifier)
error.
This error is coming from the MLS Rets server.
I am using the estately/rets gem and using Suckerpunch to run the task asynchronously. The code that results in the error:
...ANSWER
Answered 2018-Jul-02 at 22:20I ended up solving this question by adding an error rescue around the RETS query like this:
QUESTION
In my Rails 5 app I am trying to send emails with ActiveJob and Sucker Punch:
...ANSWER
Answered 2018-Apr-20 at 21:57I'm familiar with I18n within the application, but not so much in mailers. Remember that the mailer is being sent outside the request (ActiveJob), so it has no knowledge of anything that happened there. It looks like you haven't done anything to tell the mailer that it should be sending in a specific locale....
OK maybe this has the answer for you (and me!) https://niallburkley.com/blog/localize-rails-emails/
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install sucker_punch
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page