Skip to content

Commit 1df9a1d

Browse files
committed
Enhancement: change link methd to reduce PLT overhead
During TPC-DS testing, we observed that compiling postgres with libpostgres.so introduces PTL function call overhead for some functions. By linking object files (*.o) directly instead, we achieved a 5-8% performance improvement in the TPC-DS 1TB benchmark. This commit modifies the postgres linking process to directly link with the object files rather than the shared library. Additionally, this update fixes a minor bug: the pax extension has a dependency on libpostgres.so. Now, when enabling the pax entension, we check that enable_shared_postgres_backend is set to 'yes' to ensure proper functionality.
1 parent 9f9d297 commit 1df9a1d

File tree

3 files changed

+33
-16
lines changed

3 files changed

+33
-16
lines changed

configure

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,7 @@ ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
570570
#
571571
# Initializations.
572572
#
573+
ac_default_prefix=/usr/local
573574
ac_clean_files=
574575
ac_config_libobj_dir=.
575576
LIBOBJS=
@@ -759,8 +760,8 @@ HAVE_CXX14
759760
enable_gpcloud
760761
enable_shared_postgres_backend
761762
enable_mapreduce
762-
enable_catalog_ext
763763
enable_serverless
764+
enable_catalog_ext
764765
enable_orca
765766
autodepend
766767
PKG_CONFIG_LIBDIR
@@ -1608,7 +1609,7 @@ Optional Features:
16081609
--enable-cassert enable assertion checks (for debugging)
16091610
--disable-orca disable ORCA optimizer
16101611
--enable-catalog-ext enable Cloudberry catalog extension
1611-
--enable-serverless enable Cloudberry serverless mode
1612+
--enable-serverless use serverless mode of Cloudberry
16121613
--enable-mapreduce enable Cloudberry Mapreduce support
16131614
--disable-shared-postgres-backend
16141615
enable Cloudberry shared postgres backend support
@@ -1618,7 +1619,7 @@ Optional Features:
16181619
library)
16191620
--disable-preload-ic-module
16201621
disable preload interconnect module
1621-
--enable-pax enable pax support
1622+
--disable-pax disable pax support
16221623
--disable-thread-safety disable thread-safety in client libraries
16231624
--enable-openssl-redirect
16241625
enable redirect openssl interface to internal
@@ -8380,7 +8381,7 @@ $as_echo "checking whether to build with catalog extension... $enable_catalog_ex
83808381

83818382

83828383
#
8383-
# Enable serverless mode
8384+
# --enable-serverless uses serverless mode of Cloudberry
83848385
#
83858386

83868387

@@ -8407,8 +8408,8 @@ else
84078408
fi
84088409

84098410

8410-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: checking whether to use serverless architecture of Cloudberry ... $enable_serverless" >&5
8411-
$as_echo "checking whether to use serverless architecture of Cloudberry ... $enable_serverless" >&6; }
8411+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: checking whether to use serverless mode of Cloudberry... $enable_serverless" >&5
8412+
$as_echo "checking whether to use serverless mode of Cloudberry... $enable_serverless" >&6; }
84128413

84138414

84148415
#
@@ -9101,6 +9102,7 @@ fi
91019102
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: checking whether to build with preload ic module ... $enable_preload_ic_module" >&5
91029103
$as_echo "checking whether to build with preload ic module ... $enable_preload_ic_module" >&6; }
91039104

9105+
91049106
#
91059107
# pax support
91069108
#
@@ -9125,13 +9127,16 @@ $as_echo "#define USE_PAX_STORAGE 1" >>confdefs.h
91259127

91269128
else
91279129
enable_pax=yes
9128-
9129-
$as_echo "#define USE_PAX_STORAGE 1" >>confdefs.h
9130+
9131+
$as_echo "#define USE_PAX_STORAGE 1" >>confdefs.h
9132+
91309133
fi
91319134

9135+
91329136
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: checking whether to build with pax support ... $enable_pax" >&5
91339137
$as_echo "checking whether to build with pax support ... $enable_pax" >&6; }
91349138

9139+
91359140
#
91369141
# Include directories
91379142
#
@@ -15699,6 +15704,13 @@ fi
1569915704

1570015705

1570115706

15707+
# for contrib/pax_storage
15708+
if test "$enable_pax" = yes; then
15709+
if test "$enable_shared_postgres_backend" = no; then
15710+
as_fn_error $? "pax support requires --enable-shared-postgres-backend" "$LINENO" 5
15711+
fi
15712+
fi
15713+
1570215714
# for contrib/sepgsql
1570315715
if test "$with_selinux" = yes; then
1570415716
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for security_compute_create_name in -lselinux" >&5

configure.ac

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -929,10 +929,10 @@ AC_SUBST(enable_preload_ic_module)
929929
# pax support
930930
#
931931
PGAC_ARG_BOOL(enable, pax, yes,
932-
[disable PAX support],
932+
[disable pax support],
933933
[AC_DEFINE(USE_PAX_STORAGE, 1,
934-
[Define to 1 to support PAX])])
935-
AC_MSG_RESULT([checking whether to build with PAX support ... $enable_pax])
934+
[Define to 1 to support pax])])
935+
AC_MSG_RESULT([checking whether to build with pax support ... $enable_pax])
936936
AC_SUBST(enable_pax)
937937

938938
#
@@ -1749,6 +1749,13 @@ fi
17491749
AC_SUBST(LDAP_LIBS_FE)
17501750
AC_SUBST(LDAP_LIBS_BE)
17511751

1752+
# for contrib/pax_storage
1753+
if test "$enable_pax" = yes; then
1754+
if test "$enable_shared_postgres_backend" = no; then
1755+
AC_MSG_ERROR([pax support requires --enable-shared-postgres-backend])
1756+
fi
1757+
fi
1758+
17521759
# for contrib/sepgsql
17531760
if test "$with_selinux" = yes; then
17541761
AC_CHECK_LIB(selinux, security_compute_create_name, [],

src/backend/Makefile

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,22 +73,20 @@ LIBS += -lsystemd
7373
endif
7474

7575
##########################################################################
76-
7776
all: submake-libpgport submake-catalog-headers submake-utils-headers postgres $(POSTGRES_IMP)
7877

7978
ifneq ($(PORTNAME), cygwin)
8079
ifneq ($(PORTNAME), win32)
8180
ifneq ($(PORTNAME), aix)
8281

8382
ifeq ($(enable_shared_postgres_backend),yes)
83+
all: libpostgres.so
8484
libpostgres.so: $(OBJS)
8585
$(CXX) -shared $(CXXFLAGS) $(LDFLAGS) $(LDFLAGS_SL) $(export_dynamic) \
8686
$(filter-out main/main.o, $(call expand_subsys,$^)) $(LIBS) -o $@
8787

88-
postgres: main/main.o libpostgres.so $(top_builddir)/src/port/libpgport_srv.a $(top_builddir)/src/common/libpgcommon_srv.a
89-
$(CXX) $(CXXFLAGS) $(LDFLAGS) $(LDFLAGS_EX) $(export_dynamic) \
90-
main/main.o libpostgres.so $(top_builddir)/src/port/libpgport_srv.a \
91-
$(top_builddir)/src/common/libpgcommon_srv.a $(LIBS) -o $@
88+
postgres: $(OBJS)
89+
$(CXX) $(CXXFLAGS) $(call expand_subsys,$^) $(LDFLAGS) $(LDFLAGS_EX) $(export_dynamic) $(LIBS) -o $@
9290

9391
else
9492
postgres: $(OBJS)

0 commit comments

Comments
 (0)