From owner-freebsd-questions@FreeBSD.ORG Fri Mar 13 18:46:31 2015 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id ADC948B8 for ; Fri, 13 Mar 2015 18:46:31 +0000 (UTC) Received: from nm21.bullet.mail.bf1.yahoo.com (nm21.bullet.mail.bf1.yahoo.com [98.139.212.180]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 57C0032D for ; Fri, 13 Mar 2015 18:46:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.es; s=s2048; t=1426272389; bh=nXg6bq/3XDGX3W/LNR8Xg4pdzqFFHN0CqtSEaIWbdkg=; h=Date:From:To:Subject:In-Reply-To:References:From:Subject; b=lKitWsyFZ5x3ojYdW3q2yax1WA8YkGIAw6JTGKo28O2QxrU+03OcgteNtcodOVEfOhUc+rJ1Vd5Z61wIKu+/BxlS8Y3vDEmVMygtH1Ge1o9WD+BvFlHm7jV9LUSCtJCCPiuoLoz6kvcZJaWdIoQyq9TwpEnA5pQ81FrJxA6MTZten4E6heK6NFp372he/ZzXTUv+osGQ25Bwa8Q8qnKuvUllZzNlkbvxqhwgNsj5PhlQAEr1eiCMQOOLBZDddW8g3Mo6xfetKRSNmUw1W3tcBIjl3akNqbeuHf+jnAwd6NlBp5M4fZNk0M/5AX4bK2PC8pnSwk5B23Mw8d8EMiM6CA== Received: from [98.139.215.142] by nm21.bullet.mail.bf1.yahoo.com with NNFMP; 13 Mar 2015 18:46:29 -0000 Received: from [46.228.39.103] by tm13.bullet.mail.bf1.yahoo.com with NNFMP; 13 Mar 2015 18:46:29 -0000 Received: from [127.0.0.1] by smtp140.mail.ir2.yahoo.com with NNFMP; 13 Mar 2015 18:46:26 -0000 X-Yahoo-Newman-Id: 541737.71061.bm@smtp140.mail.ir2.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: 5Q7RA20VM1lkWHKOcKkiLK8YHo_rO8dlmXYxjaGsMP8LiiY icW1NZYlMmUufMO2u.XIG4cqqH4TCeiqLH7ot61RAVj0TAISNjajaVb6LKod p46BO.y8m2SLrRYhIkORAcUI2jef82rDE_i23oLioVs5aEtWIHRYSWfBW891 hK9y_HWfKLNOywOpkCKsYdZdrYv2P6G4KLlcYrb2gYEw.Y2rGNAypwJTwST8 TCox0JXlSZ54kpyMNqSyUhP4NVKFOFQwgPF73kovhlZHyzzghGDZmcdb5gHI BL9cCWt6WaF5cEaPJ8RaFiiXUcoUHSgKM1m7Yrrf.nrTwpWJmByMN2bPdXNx gZB1j.BiqFjHKnmjKSgODa3zd73g4hRs1SkobLxJzV8E2POcFz9t3cDDUWxr 5RERQNe2vclnEvzZXK19S5QMnJNOVKQrBjrrmG.4VymNwChVEtXWRuwZ.mny PvFUEzFhvYktpu8627NlQAgh93X4Se7kHjjdJjNPTtkxYhDBg9KiUp5P4OA- - X-Yahoo-SMTP: mX392iiswBAeJNdO_s.EW62LZDJR Date: Fri, 13 Mar 2015 19:46:37 +0100 From: Eduardo Morras To: freebsd-questions@freebsd.org Subject: Re: Limiting CPU on some processes on web server Message-Id: <20150313194637.a509370f64ad0697e3c09a70@yahoo.es> In-Reply-To: <20150311122656.96F2020341@smtp.hushmail.com> References: <20150311122656.96F2020341@smtp.hushmail.com> X-Mailer: Sylpheed 3.4.2 (GTK+ 2.24.25; amd64-portbld-freebsd9.3) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Mar 2015 18:46:31 -0000 On Wed, 11 Mar 2015 12:26:56 +0000 opendaddy@hushmail.com wrote: > Hi! > > I run this web app that depends on ImageMagick to process images and > ffmpeg to process videos. These processes, unfortunately, consume > 100% of my CPU, rendering my web app unusable (gateway timeout). > > Tried `nice -n 19` but to no avail. > > What other options do I have? You can use cpuset from shell script, if use imagemagick: cpuset -c -l 1 /usr/local/bin/ImageMagick to restrict imagemagick to use cpu 1. If process is running, use cpuset -c -l 0,2 -p To force your webapp to run only on cpus 0 and 2 Check man cpuset and man 2 cpuset for more information. > Thanks! > > O.D. --- --- Eduardo Morras