Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1roi3V-002wLu-3C for pgsql-odbc@arkaria.postgresql.org; Mon, 25 Mar 2024 10:59:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1roi3T-002Qd7-LC for pgsql-odbc@arkaria.postgresql.org; Mon, 25 Mar 2024 10:59:52 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1roi3T-002Qcz-EJ for pgsql-odbc@lists.postgresql.org; Mon, 25 Mar 2024 10:59:51 +0000 Received: from pgintl.fastcrypt.com ([149.56.129.164]) by magus.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1roi3Q-006NvJ-I4 for pgsql-odbc@lists.postgresql.org; Mon, 25 Mar 2024 10:59:51 +0000 Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com [209.85.208.54]) by pgintl.fastcrypt.com (Postfix) with ESMTPSA id 18C94201BA for ; Mon, 25 Mar 2024 06:59:44 -0400 (EDT) Received: by mail-ed1-f54.google.com with SMTP id 4fb4d7f45d1cf-56bc8cfc19fso4578680a12.1 for ; Mon, 25 Mar 2024 03:59:44 -0700 (PDT) X-Gm-Message-State: AOJu0YxG+7irsjQcKL3JOMOOk7yf8cIuTSJ2pxCFtX2BnpGy2ixheN8j +R3XS+GtpkabnBAW1qxj7Gw91v2MfhlWmGYTWOdMresmaR1IePYM+qRgfWP7+CGmXKjKNCS2I0/ UUiA7cDhYo07ybLaKuDMtFm/ecT4= X-Google-Smtp-Source: AGHT+IHBbc9sNye8fJRefC0FjTekmeXs4UhOZg7ExG331Te7PNXbIObrj8Pb/R/AYGZywYAQ1t/4ipMQtKu3FdTPAwY= X-Received: by 2002:a17:906:a107:b0:a47:34bd:db75 with SMTP id t7-20020a170906a10700b00a4734bddb75mr4016730ejy.5.1711364383409; Mon, 25 Mar 2024 03:59:43 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Dave Cramer Date: Mon, 25 Mar 2024 06:59:25 -0400 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] Using mimalloc to improve performance and reduce memory allocation lock contention To: Adrian Grucza Cc: pgsql-odbc@lists.postgresql.org Content-Type: multipart/alternative; boundary="00000000000027a50f06147a12e7" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000027a50f06147a12e7 Content-Type: text/plain; charset="UTF-8" On Mon, 25 Mar 2024 at 01:42, Adrian Grucza wrote: > Hi, > > We have a multi-threaded Windows application that was experiencing delays > due to high lock contention in memory allocations from the PostgreSQL ODBC > driver. We tried modifying the driver to use mimalloc > , which is a memory allocator with > better performance characteristics. After deploying this change, the delays > due to lock contention disappeared. It has been running on thousands of our > production deployments for 9 months without issue. > > I've created this pull request > so that others > can benefit from this change by building the driver with the _MIMALLOC_ > symbol defined and linking to the mimalloc library. > > In my patch, the usage of mimalloc is off by default, so it should be safe > to merge. But I'd like to get people's thoughts on whether it should be > enabled by default so that people can benefit from this change without > having to build the driver themselves. > Cool, Thanks, I will have a look Dave > --00000000000027a50f06147a12e7 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Mon, 25 Mar 202= 4 at 01:42, Adrian Grucza <ad= rian.grucza@iress.com> wrote:
Hi,

We have a multi-threaded Windows application = that was experiencing delays due to high lock contention in memory allocati= ons from the PostgreSQL ODBC driver. We tried modifying the driver to use <= a href=3D"https://github.com/microsoft/mimalloc" target=3D"_blank">mimalloc= , which is a memory allocator with better performance characteristics. = After deploying this change, the delays due to lock contention disappeared.= It has been running on thousands of our production deployments for 9 month= s without issue.

I've created this= pull request so that others can benefit from this change by building t= he driver with the _MIMALLOC_ symbol define= d and linking to the mimalloc library.

In my= patch, the usage of mimalloc is off by default, so it=C2=A0should be safe = to merge. But I'd like to get people's thoughts on whether it shoul= d be enabled by default so that people can benefit from this change without= having to build the driver themselves.

Cool,=C2=A0

Thanks,= I will have a look

Dave
--00000000000027a50f06147a12e7--