Date: Wed, 11 Mar 2015 20:46:28 +0100 From: Roland Smith <rsmith@xs4all.nl> To: opendaddy@hushmail.com Cc: freebsd-questions@freebsd.org Subject: Re: Limiting CPU on some processes on web server Message-ID: <20150311194628.GB8178@slackbox.erewhon.home> In-Reply-To: <20150311122656.96F2020341@smtp.hushmail.com> References: <20150311122656.96F2020341@smtp.hushmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--0eh6TmSyL6TZE2Uz Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Mar 11, 2015 at 12:26:56PM +0000, opendaddy@hushmail.com wrote: > Hi! > > I run this web app that depends on ImageMagick to process images and ffmp= eg > to process videos. These processes, unfortunately, consume 100% of my CPU, > rendering my web app unusable (gateway timeout). *How* does the web app actually start those programs? E.g. if the web app is written in Python, it should use subprocess.Popen() instead of subprocess.call or subprocess.check-output(), because the latter two would block the calling program. As far as I can tell, ImageMagick only uses one core. And whether ffmepg c= an use multiple cores depends on the encoder. X264 can use multiple cores, but Theora can=C2=B4t. So on a relatively modern (multi-core) CPU launching one or two CPU intensi= ve programs should leave enough cores for your web-app. > Tried `nice -n 19` but to no avail. Have you verified with `ps -l` (or `ps -xal`) that the ffmeg and convert processes are actually running at a lower priority? Try using /usr/bin/nice directly instead of using the shell's built-in nice= (assuming the web app starts the commands from a shell?). > What other options do I have? Run you web app stack with a higher priority. Roland --=20 R.F.Smith http://rsmith.home.xs4all.nl/ [plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated] pgp: 5753 3324 1661 B0FE 8D93 FCED 40F6 D5DC A38A 33E0 (keyID: A38A33E0) --0eh6TmSyL6TZE2Uz Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAABCAAGBQJVAJuUAAoJEED21dyjijPgTxAP/0f17q8RUXyDKix61OQu6uKF nwlI0G872mYasgrPdMwGP/YaXD7U3QFN7SXwCF5Ce1ruh4EjZWAdk3S6dLqt7rwv yRhuPXsWlS9QzB6hdtYHEcNw/g41g0o9m/hhvVuKGy9jQC4UgIz8Ymj6IaKTptGX Tv7W7nyE51fvHNibXy6DCd00+73VR4JoD26JRzd6qU90D7mAxdqllEIbdcgViFEX NtT0nPb2pzdcF8/E2KPnb+bpnwMSKbiJh+bFgfdSBlXxL0jw5+0sdR2c3NSWh7e7 VpKvSq9DeI1BgZMs0TKjSFFQPQ1Jjl03Bj1ZD8tMzJQiGWc5Yc/d3nT0sFJHiN/F YC9WjGkMpe4zdXL54Mv8yQGgj03q+ltTikMzzsGHy95quQsVAmnaYBw2361rXjpG uH8rp5BRnUy/qNjZv1Z0RO7yws+BLwe0PnMaITReMl1okGb5okyhYD5kB9Wnk/OY zcjCoLvM2l4jXep1lxs9TSfJ3StOl/I0VOTjORJMO3O7+T4iSjC/10cy6p/dSQhz fM7RtzHMJd8WnWRKvmOLyPAly40HjQ6CrHyaY8wPpV4NyDCmcLfyOAzz/76U84fh hdfjK263ocAwcyLKrUvBbnxgv9hY04Oxdoqm/KF8EtONtkFspURuNI9/oX1PFOuI yl/F+WQno6mZDhUQjAQ5 =eh6J -----END PGP SIGNATURE----- --0eh6TmSyL6TZE2Uz--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150311194628.GB8178>