Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cW5Lw-00083Y-E0 for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Jan 2017 17:57:56 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cW5Lv-0007o6-Et for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Jan 2017 17:57:55 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cW5Lu-0007kZ-8O for pgsql-hackers@postgresql.org; Tue, 24 Jan 2017 17:57:54 +0000 Received: from mail-wm0-x229.google.com ([2a00:1450:400c:c09::229]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1cW5Lq-0006SY-78 for pgsql-hackers@postgresql.org; Tue, 24 Jan 2017 17:57:53 +0000 Received: by mail-wm0-x229.google.com with SMTP id c85so193948328wmi.1 for ; Tue, 24 Jan 2017 09:57:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=yc5vxXkoGRXOOkzltE3tWqXTCIQpWVau1/BMyHXHdYg=; b=NobTMrwI4iGqmKJt6oh3thIXh7niGDI0V7/3qIjOduBuO8jy+qrdnOhgFPrZnv7jxK A8EEZIx7n5VIhmBPlWrVGs8lEBR0U0+ciEt1jkJZnONkuPodPrSNzrtS5ghvABXxm1Ha XIoUrJgE3nWMILnEDPUzs04Zvzxkx4dCo7/zhaZMa3KHLluph/TicIxk6Ni0edjnQc1N 6jJHvQXbNzOsISc6WvGbNMcbbHoP7nTRgxJdaJAw3m4TF8XIfHDhQQEBmY27xUyfKOkp Wgu4NRhuGez6ZedXckZxnlWa9JKf2cBTl1iFG0mYsCkehRvxukc68fXHZkxjaSlX5BQC cfzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=yc5vxXkoGRXOOkzltE3tWqXTCIQpWVau1/BMyHXHdYg=; b=mtlHXI4l4HqjJDlmaxIZaIgQjeYgK8yvv8QEW0e7LTKGmfZmCMlDvH7sU3juP086HG YErE+uKew/i7+vbtbMZeT7eYnw4P8z0gZa8mgD54T2wrhPf9JLsX3vf82yDJ+FoauR3a pMKMS0Ue5HSQY7Qg+PsjUxwl0XdSzhYBqO0tncguS9/jwlx+o/nlXQHdUCms5HLLBbsR 033yOb+6bDjYfyBnDqRV86M5HsInXqTTYkf8Pvl7gn8wiOQDjLldWwb2rL+fP4ntxenY 7R6c78s2uBnq7dd94DN3lEiMxfnBNYY7zku5Npp9ZEbf0qZ0H3uCFNUYsCySZwt4j693 cFkw== X-Gm-Message-State: AIkVDXKdfz8VEAvFIJA+kjv8/dyl7ELhXb02X5Fi8sbtW+pK+33AJaNz1Pg2SziU7EqgmQ== X-Received: by 10.223.138.220 with SMTP id z28mr29564923wrz.26.1485280669152; Tue, 24 Jan 2017 09:57:49 -0800 (PST) Received: from [192.168.1.211] (ppp-93-104-181-116.dynamic.mnet-online.de. [93.104.181.116]) by smtp.googlemail.com with ESMTPSA id k43sm21023512wrc.46.2017.01.24.09.57.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Jan 2017 09:57:48 -0800 (PST) Subject: Re: lseek/read/write overhead becomes visible at scale .. To: Andres Freund References: <20170124171841.2n2nzqkuetbivzta@alap3.anarazel.de> <20170124174158.nk6htg7jjmqia7hr@alap3.anarazel.de> Cc: pgsql-hackers@postgresql.org From: Tobias Oberstein Message-ID: <422b4e6c-b7f0-90e0-6f70-389b2d50a848@gmail.com> Date: Tue, 24 Jan 2017 18:57:47 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <20170124174158.nk6htg7jjmqia7hr@alap3.anarazel.de> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Hi, Am 24.01.2017 um 18:41 schrieb Andres Freund: > Hi, > > On 2017-01-24 18:37:14 +0100, Tobias Oberstein wrote: >>> assume that it'd get more than swamped with doing actualy work, and with >>> buffering the frequently accessed stuff in memory. >>> >>> >>>> What I am trying to say is: the syscall overhead of doing lseek/read/write >>>> instead of pread/pwrite do become visible and hurt at a certain point. >>> >>> Sure - but the question is whether it's measurable when you do actual >>> work. >> >> The syscall overhead is visible in production too .. I watched PG using perf >> live, and lseeks regularily appear at the top of the list. > > Could you show such perf profiles? That'll help us. oberstet@bvr-sql18:~$ psql -U postgres -d adr psql (9.5.4) Type "help" for help. adr=# select * from svc_sqlbalancer.f_perf_syscalls(); NOTICE: starting Linux perf syscalls sampling - be patient, this can take some time .. NOTICE: sudo /usr/bin/perf stat -e "syscalls:sys_enter_*" -x ";" -a sleep 30 2>&1 pid | syscall | cnt | cnt_per_sec -----+---------------------------------------+---------+------------- | syscalls:sys_enter_lseek | 4091584 | 136386 | syscalls:sys_enter_newfstat | 2054988 | 68500 | syscalls:sys_enter_read | 767990 | 25600 | syscalls:sys_enter_close | 503803 | 16793 | syscalls:sys_enter_newstat | 434080 | 14469 | syscalls:sys_enter_open | 380382 | 12679 | syscalls:sys_enter_mmap | 301491 | 10050 | syscalls:sys_enter_munmap | 182313 | 6077 | syscalls:sys_enter_getdents | 162443 | 5415 | syscalls:sys_enter_rt_sigaction | 158947 | 5298 | syscalls:sys_enter_openat | 85325 | 2844 | syscalls:sys_enter_readlink | 77439 | 2581 | syscalls:sys_enter_rt_sigprocmask | 60929 | 2031 | syscalls:sys_enter_mprotect | 58372 | 1946 | syscalls:sys_enter_futex | 49726 | 1658 | syscalls:sys_enter_access | 40845 | 1362 | syscalls:sys_enter_write | 39513 | 1317 | syscalls:sys_enter_brk | 33656 | 1122 | syscalls:sys_enter_epoll_wait | 23776 | 793 | syscalls:sys_enter_ioctl | 19764 | 659 | syscalls:sys_enter_wait4 | 17371 | 579 | syscalls:sys_enter_newlstat | 13008 | 434 | syscalls:sys_enter_exit_group | 10135 | 338 | syscalls:sys_enter_recvfrom | 8595 | 286 | syscalls:sys_enter_sendto | 8448 | 282 | syscalls:sys_enter_poll | 7200 | 240 | syscalls:sys_enter_lgetxattr | 6477 | 216 | syscalls:sys_enter_dup2 | 5790 | 193 Note: there isn't a lot of load currently (this is from production). >>> I'm much less against this change than Tom, but doing artificial syscall >>> microbenchmark seems unlikely to make a big case for using it in >> >> This isn't a syscall benchmark, but FIO. > > There's not really a difference between those, when you use fio to > benchmark seek vs pseek. Sorry, I don't understand what you are talking about. >>> postgres, where it's part of vastly more expensive operations (like >>> actually reading data afterwards, exclusive locks, ...). >> >> PG is very CPU hungry, yes. > > Indeed - working on it ;) > > >> But there are quite some system related effects >> too .. eg we've managed to get down the system load with huge pages (big >> improvement). > > Glad to hear it. With 3TB RAM, huge pages is absolutely essential (otherwise, the system bogs down in TLB etc overhead). >>> I'd welcome seeing profiles of that - I'm working quite heavily on >>> speeding up analytics workloads for pg. >> >> Here: >> >> https://github.com/oberstet/scratchbox/raw/master/cruncher/adr_stats/ADR-PostgreSQL-READ-Statistics.pdf >> >> https://github.com/oberstet/scratchbox/tree/master/cruncher/adr_stats > > Thanks, unfortunately those appear to mostly have io / cache hit ratio > related stats? Yep, this was just to proof that we are really running a DWH workload at scale;) Cheers, /Tobias > > Greetings, > > Andres Freund > -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers