Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Jul 2018 18:44:01 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Thomas Munro <munro@ip9.org>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Patching setproctitle() to go faster, for PostgreSQL
Message-ID:  <20180702154401.GB2430@kib.kiev.ua>
In-Reply-To: <CADLWmXWCj_WgYfQfzUL_aFLYYqezmbivzF=gKyk%2B6JqPcBvbXQ@mail.gmail.com>
References:  <CADLWmXWCj_WgYfQfzUL_aFLYYqezmbivzF=gKyk%2B6JqPcBvbXQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Jul 03, 2018 at 12:53:28AM +1200, Thomas Munro wrote:
> Hi FreeBSD hackers,
> 
> PostgreSQL's update_process_titles setting, which defaults to on,
> slows busy databases down quite noticeably on FreeBSD and so a lot of
> people turn it off.  Having that information in ps/top/htop is nice,
> so I don't like turning it off.  It was a rainy Sunday here yesterday
> so I decided to hack on that.  I wrote an experimental patch,
> attached, that essentially reverts to the ancient syscall-free BSD
> behaviour (?) on a per-process basis, for processes that are
> update-heavy.  That raises some interesting questions about torn
> reads, I admit...
> 
> I didn't see much difference in "pgbench" on my laptop, but on an AWS
> m4.10xlarge (40 vCPU) machine I could easily see a difference.  I
> think there is probably a contention effect somewhere that gets worse
> with more concurrency.
> 
> pgbench -i -s 10 postgres
> pgbench -T60 -c 40 -j 40 -S -M prepared postgres
> 
> Stock 11.2,   update_process_titles = on:     472873 TPS (default)
> Stock 11.2,   update_process_titles = off:    539391 TPS (~13% faster
> than default)
> Patched 11.2, update_process_titles = on:     519733 TPS (~10% faster
> than default)
> 
> I'd be grateful for any feedback.

The kernel chunk looks fine.

For the libc, I am not so sure. Why five, why not taking into the
account the frequency, what users could do if they want the old
behaviour e.g. to see the args in vmcore, and so on.

Is modifying posgresql sources acceptable ? If yes, I propose that you add
setproctitle_fast(3) (I do not insist on the name).



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20180702154401.GB2430>