
Security News
Vite Releases Technical Preview of Rolldown-Vite, a Rust-Based Bundler
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
=== Oink
=== Description
Rails plugin and log parser to help narrow down the source(s) of increased memory usage in rails applications.
=== Synopsis
Oink adds memory and active record instantiation information to rails log during runtime and provides an executable to help digest the enhanced logs.
Given a minimum threshold and a metric (memory or active record instantiation), the oink executable reports:
Many thanks to Ben Johnson for Memory Usage Logger (http://github.com/binarylogic/memory_usage_logger/tree/master) which is the basis of this plugin.
== Dependencies
Currently oink can only parse logs in the Hodel3000Logger format
When used as a gem, this is automatically brought in as a dependency.
=== Installation and configuration
To begin, you'll want to install it:
gem install oink
Next, you'll need to update your config/environment.rb to include oink as a dependency, and to configure Rails to use the hodel_3000_compliant_logger:
Rails::Initializer.run do |config| # your other config here config.gem 'oink' begin require 'hodel_3000_compliant_logger' config.logger = Hodel3000CompliantLogger.new(config.log_path) rescue LoadError => e $stderr.puts "Hodel3000CompliantLogger unavailable, oink will be disabled" end end
Oink allows you to add two type of statistics to your log output: memory usage and number of ActiveRecord objects instantiated. Here's an example for the output you can get:
Feb 08 11:39:54 ey33-s00302 rails[9076]: Memory usage: 316516 | PID: 9076 Feb 27 13:21:04 ey04-s00295 rails[11862]: Instantiation Breakdown: Total: 73 | User: 34 | Group: 20 | Medium: 20 | Sport: 10 | Post: 4 | Discussion: 2
For memory usage, add this to app/controllers/application_controller.rb:
class ApplicationController include Oink::MemoryUsageLogger end
For ActiveRecord objects instantiated, add this to your app/controllers/application_controller.rb:
class ApplicationController include Oink::InstanceTypeCounter end
== Analyizing logs
After installing the plugin and aggregating some enhanced logs, run the 'oink' executable against your server logs.
Usage: oink [options] files -t, --threshold [INTEGER] Memory threshold in MB -f, --file filepath Output to file --format FORMAT Select format (ss,v,s,verbose,short-summary,summary) -m, --memory Check for Memory Threshold (default) -r, --active-record Check for Active Record Threshold
Oink hunts for requests which exceed a given threshold. In "memory" mode (the default), the threshold represents a megabyte memory increase from the previous request. In "active record" mode (turned on by passing the --active-record switch), the threshold represents the number of active record objects instantiated during a request.
e.g. To find all actions which increase the heap size more than 75 MB, where log files are location in /tmp/logs/
$ oink --threshold=75 /tmp/logs/* ---- MEMORY THRESHOLD ---- THRESHOLD: 75 MB
-- SUMMARY -- Worst Requests:
Worst Actions: 10, DashboardsController#show 9, GroupsController#show 5, PublicPagesController#show 5, UsersController#show 3, MediaController#show 2, SportsController#show 1, SessionsController#create 1, GroupInvitesController#by_email 1, MediaController#index 1, PostsController#show 1, PhotoVotesController#create 1, AlbumsController#index 1, SignupsController#new 1, ColorSchemesController#show 1, PublicPagesController#join 1, CommentsController#create
e.g. In verbose mode, oink will print out all the log information from your logs about the actions which exceeded the threshold specified
$ oink --format verbose --threshold=75 /tmp/logs/*
Verbose format prints the summary as well as each action which exceeded the threshold.
=== Authors
FAQs
Unknown package
We found that oink-transcode demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
Research
Security News
A malicious npm typosquat uses remote commands to silently delete entire project directories after a single mistyped install.
Research
Security News
Malicious PyPI package semantic-types steals Solana private keys via transitive dependency installs using monkey patching and blockchain exfiltration.