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 1rod63-002Uw2-75 for pgsql-odbc@arkaria.postgresql.org; Mon, 25 Mar 2024 05:42:11 +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 1rod61-0002TX-R9 for pgsql-odbc@arkaria.postgresql.org; Mon, 25 Mar 2024 05:42:10 +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 1rod61-0002TO-I2 for pgsql-odbc@lists.postgresql.org; Mon, 25 Mar 2024 05:42:10 +0000 Received: from mx07-00574e01.pphosted.com ([205.220.184.3]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rod5w-006LOJ-Qb for pgsql-odbc@lists.postgresql.org; Mon, 25 Mar 2024 05:42:08 +0000 Received: from pps.filterd (m0214001.ppops.net [127.0.0.1]) by mx08-00574e01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 42OLJGkP028333 for ; Mon, 25 Mar 2024 05:42:02 GMT Received: from mail-lj1-f197.google.com (mail-lj1-f197.google.com [209.85.208.197]) by mx08-00574e01.pphosted.com (PPS) with ESMTPS id 3x1m7m2d01-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Mon, 25 Mar 2024 05:42:01 +0000 (GMT) Received: by mail-lj1-f197.google.com with SMTP id 38308e7fff4ca-2d6d3815f9bso5975301fa.0 for ; Sun, 24 Mar 2024 22:42:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711345321; x=1711950121; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=kvgbEuFa6h0mzkAPkmLVa0zjWm1YK63ENtSzMyhOcH4=; b=GeQ/WCL2oNKW4L6ePlSi6kAPZdwCkRTHoXX5juC2a+27Z43GP+f/hvK7Un6gRQcP9J oCxw0UFnZqBu8IohizYYz4Dra16n7PL1//8HslpMrOxOhEEWdvoppxju7+7Yg/2phNAK sSnOvdxuKBtjCQPoDhIBm1N8ug58lVNXyjBOqbkDRgxwDjJ9ToPoHkqTNGk4QhaXIm1M UM1FtAnw15138sbjG2Op7NdBHnz2loxpfPhvdzP3GSk+G1sqKyu4oAWNScecEGF1hL+W zETMT8QIUcljioluJcvy7frxdbSu4B2bL+BpttCjM0ce9+w8ARII2//l5bHA1oJfo+GM FcjA== X-Gm-Message-State: AOJu0Yyr3N/bqlpVhIh2NR0KjWDJJA2kHC6l3/YViZ8Xj6zcCEH2KhJJ Jyb1ChV9TlpiB4ynSTMpMY3KY0rOGDQO5Z54fXPGEDMZDn4f1DqgLarAZjsyev6Y6gcEcsMQjM2 bpnBN3P+zsTUTidoR0AL6j209a7h2XogEuG6XPAgx4SECpBHWFEmEWGiZt5OXtMas9BOc9jya2F uFzjBi6Y12doFZBJEeF0pKGswOT5Ta0ii5JZlC4S/Dd3Ye X-Received: by 2002:a2e:938e:0:b0:2d4:94eb:e9fe with SMTP id g14-20020a2e938e000000b002d494ebe9femr4629590ljh.21.1711345320925; Sun, 24 Mar 2024 22:42:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFg+zfCM31LOg2VfdB0iE1hRPYLEPuU7uDWeQ8cxQO8rj41wdO7tKC+IQTXAVKmknOrC9ic5l/+30wq X-Received: by 2002:a2e:938e:0:b0:2d4:94eb:e9fe with SMTP id g14-20020a2e938e000000b002d494ebe9femr4629578ljh.21.1711345320537; Sun, 24 Mar 2024 22:42:00 -0700 (PDT) Received: from eu2.smtp.exclaimer.net (eu2.smtp.exclaimer.net. [52.169.0.179]) by smtp-relay.gmail.com with ESMTPS id lc15-20020a170906f90f00b00a3f86c8eefcsm369952ejb.126.2024.03.24.22.41.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 24 Mar 2024 22:42:00 -0700 (PDT) X-Relaying-Domain: iress.com Received: from mail-lf1-f70.google.com (209.85.167.70) by eu2.smtp.exclaimer.net (52.169.0.179) with Exclaimer Signature Manager ESMTP Proxy eu2.smtp.exclaimer.net (tlsversion=TLS12, tlscipher=TLS_ECDHE_WITH_AES256_SHA1); Mon, 25 Mar 2024 05:42:00 +0000 X-ExclaimerHostedSignatures-MessageProcessed: true X-ExclaimerProxyLatency: 6134983 X-ExclaimerImprintLatency: 3239789 X-ExclaimerImprintAction: 1a200611e8734228956be44f2c546eb3 Received: by mail-lf1-f70.google.com with SMTP id 2adb3069b0e04-5159663d035so3460901e87.0 for ; Sun, 24 Mar 2024 22:41:59 -0700 (PDT) X-Received: by 2002:a05:651c:1a24:b0:2d6:c9e8:cadb with SMTP id by36-20020a05651c1a2400b002d6c9e8cadbmr4666785ljb.46.1711345318687; Sun, 24 Mar 2024 22:41:58 -0700 (PDT) X-Received: by 2002:a05:651c:1a24:b0:2d6:c9e8:cadb with SMTP id by36-20020a05651c1a2400b002d6c9e8cadbmr4666778ljb.46.1711345318342; Sun, 24 Mar 2024 22:41:58 -0700 (PDT) MIME-Version: 1.0 From: Adrian Grucza Date: Mon, 25 Mar 2024 16:41:40 +1100 Message-ID: Subject: [PATCH] Using mimalloc to improve performance and reduce memory allocation lock contention To: pgsql-odbc@lists.postgresql.org Content-Type: multipart/alternative; boundary="000000000000c9e7ad061475a1c1" X-Proofpoint-GUID: r0hYwiD-jj34W3_3xPpxPumq6M3lIFRk X-Proofpoint-ORIG-GUID: r0hYwiD-jj34W3_3xPpxPumq6M3lIFRk List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --000000000000c9e7ad061475a1c1 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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. Regards, Adrian Adrian Grucza Technical Lead Office: +61390185800 adrian.grucza@iress.com www.iress.com Level 16 385 Bourke St Melbourne, Victoria, 3000 The contents of this email originated from Iress. For this purpose Iress in= cludes Iress Limited and/or any of its subsidiaries, holding companies and = trading entities. =E2=80=8BIf you have received this email in error please = notify the sender immediately and delete this email. nosig --000000000000c9e7ad061475a1c1 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
Hi,

We have a multi-threaded Windows application t= hat was experiencing delays due to high lock contention in memory allocatio= ns from the PostgreSQL ODBC driver. We tried modifying the driver to use mimalloc, which is a me= mory allocator with better performance characteristics. After deploying thi= s change, the delays due to lock contention disappeared. It has been runnin= g 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= =2E

In my patch, the usage of mimalloc is of= f by default, so it=C2=A0should be safe to merge. But I'd like to get p= eople's thoughts on whether it should be enabled by default so that peo= ple can benefit from this change without having to build the driver themsel= ves.

Regards,
Adrian

<= /div>
3D"iress.com"
=
Adrian Grucza​<= span style=3D"font-family:'template--YFhO5eUEemrxAANOiIVDQ';">̴= 3;  =
Technical Le= ad
=
O= ffice: +61390185800
adrian.grucza@iress.com
www.iress.com
Level 16 385 Bou= rke St
 Melbourne, Victoria, 3000
The contents of= this email originated from Iress. For this purpose Iress includes Iress Li= mited and/or any of its subsidiaries, holding companies and trading entitie= s. ​If you have received this email in error please notify the sender= immediately and delete this email. 
nosig
--000000000000c9e7ad061475a1c1--