Skip to content

ICTPLSys/MemLiner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MemLiner README

MemLiner is a managed runtime built for a memory-disaggregated cluster where each managed application runs on one server and uses both local memory and remote memory located on another server. When launched on MemLiner,the process fetches data from the remote server via the paging system. MemLiner reduces the local-memory working set and improves the remote-memory prefetching by lining up the memory accesses from application and GC threads. MemLiner is transparent to applications and can be integrated in any existing GC algorithms, such as G1 and Shenandoah. Please refer to our OSDI'22 paper, MemLiner and TOCS'25 paper Lining up Garbage Collection and Application for a Far-Memory-Friendly Runtime, for more details.

1. Build & Install MemLiner

1.1 Environments

Two sets of environment have been tested for MemLiner:

Ubuntu 20.04
Linux 5.11
OpenJDK 12
GCC 7.5 
MLNX_OFED driver 5.6-2.0.9.0

Among the requirements, the Linux version, OpenJDK version and MLNX-OFED driver version are guaranteed during the build & installation process below. Just make sure that the Linux distribution version and gcc version are correct.

1.2 Install Kernel

Next we will use Ubuntu 20.04 and GCC 7.5 as an example to show how to build and install the kernel. Please change the kernel on both CPU and memory server.

(1)Build the Kernel source code && install it. In case new kernel options are prompted during sudo ./build_kernel.sh build, press enter to use the default options.

# Change to the kernel folder:
cd MemLiner/Kernel

# In case new kernel options are prompted, press enter to use the default options.
sudo ./build_kernel.sh build
sudo ./build_kernel.sh install

(2) Change the grub parameters

sudo vim /etc/default/grub

# Choose the bootup kernel version as 5.11.0-fastswap(from MemLiner/Kernel)
GRUB_DEFAULT="Advanced options for GNU/Linux>GNU/Linux, with Linux 5.11.0-fastswap"

# Change the value of GRUB_CMDLINE_LINUX:
GRUB_CMDLINE_LINUX="nokaslr transparent_hugepage=madvise intel_pstate=disable idle=poll processor.max_cstate=0 intel_idle.max_cstate=0"

sudo update-grub
sudo reboot

1.3 Install MLNX OFED Driver

Preparations:

MemLiner is only tested on MLNX_OFED-5.6-2.0.9.0. Download and unzip the package according to your system version, on both CPU and memory server.

Take Ubuntu 18.04 as an example:

1.3.1 Download & Install the MLNX_OFED driver

check MLNX_OFED and Download MLNX_OFED_LINUX-5.6-2.0.9.0-ubuntu20.04-x86_64.tgz

# Download the MLNX OFED driver for the Ubuntu 20.04
tar xzf MLNX_OFED_LINUX-5.6-2.0.9.0-ubuntu20.04-x86_64.tgz
cd MLNX_OFED_LINUX-5.6-2.0.9.0-ubuntu20.04-x86_64.tgz

# Remove the incompatible libraries
sudo apt remove ibverbs-providers:amd64 librdmacm1:amd64 librdmacm-dev:amd64 libibverbs-dev:amd64 libopensm5a libosmvendor4 libosmcomp3 -y

# Install the MLNX OFED driver against the kernel 5.4.0
sudo ./mlnxofedinstall --add-kernel-support

1.3.2 Enable the opensm and openibd services

(1) Enable and start the openibd service

sudo systemctl enable openibd
sudo systemctl start  openibd

# confirm the service is running and enabled:
sudo systemctl status openibd

# the log shown as:
● openibd.service - openibd - configure Mellanox devices
   Loaded: loaded (/lib/systemd/system/openibd.service; enabled; vendor preset: enabled)
   Active: active (exited) since Mon 2022-05-02 14:40:53 CST; 1min 24s ago
    

(2) Enable and start the opensmd service:

sudo systemctl enable opensmd
sudo systemctl start opensmd

# confirm the service status
sudo systemctl status opensmd

# the log shown as:
opensmd.service - LSB: Manage OpenSM
   Loaded: loaded (/etc/init.d/opensmd; generated)
   Active: active (running) since Mon 2022-05-02 14:53:39 CST; 10s ago

#
# Warning: you may encounter the problem:
#
opensmd.service is not a native service, redirecting to systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable opensmd
update-rc.d: error: no runlevel symlinks to modify, aborting!

#
# Please refer to the **Question #2** in FAQ for how to solve this problem
#

1.3.3 Confirm the InfiniBand is available

Check the InfiniBand information

# Get the InfiniBand information
ibstat

# the log shown as:
# Adapter's stat should be Active.

	Port 1:
		State: Active
		Physical state: LinkUp
		Rate: 100
		Base lid: 3
		LMC: 0
		SM lid: 3
		Capability mask: 0x2651e84a
		Port GUID: 0x0c42a10300605e88
		Link layer: InfiniBand

1.3.4 For other OS distributions

(1) CentOS 7.7

Install the necessary libraries

sudo yum install -y gtk2 atk cairo tcl tk

Download the MLNX OFED driver for CentOS 7.7

And then, repeat the steps in 1.3.

1.4 Build the RemoteSwap data path and connect CPU server and memory servers.

The user needs to build the RemoteSwap on both the CPU server and memory servers.

1.4.1 Configuration

(1) IP configuration

Assign memory server’s ip address to both the CPU server and memory servers. Take guest@ict-1(CPU server) and guest@ict-2(Memory server) as an example. Suppose the memory server’s InfiniBand IP address is 10.0.0.2: (IPs of IB on other servers can be printed with ifconfig ib0 | grep inet)

Modify parameters in MemLiner/remoteswap/client/manage_rswap_client.sh.

mem_server_ip="10.0.0.2"
mem_server_port="9400"

swap_file="${home_dir}/swapfile"
SWAP_PARTITION_SIZE_GB="32"

1.4.2 Build the RemoteSwap datapath

(1) Build the server end on the memory server, e.g., guest@ict-2

cd /MemLiner/remoteswap/server
make clean
make
# Make sure the core number of the cpu server is configured correctly, otherwise the CPU server will crash in the next step.
./rswap-server <memory server ip> <memory server port> <swapfile size in GB> <number of cores on cpu server>

(2) Build the client end on the CPU server, e.g., guest@ict-1

cd MemLiner/remoteswap/client
make clean
make
./manage_rswap_client.sh install

1.5 Build MemLiner (OpenJDK) on CPU server

Build MemLiner JDK. Please download and install jdk-12.0.2 and other dependent libraries to build the MemLiner (OpenJDK)

cd ${HOME}/MemLiner/JDK
./configure --with-boot-jdk=$HOME/jdk-12.0.2 --with-debug-level=release
make -j$nproc

2. Configuration

2.1 Connect the CPU server with the memory server

Warning: The CPU server and the memory server only need to be connected once, and the connection will persist until reboot or memory server process is killed. Before trying to connect, check whether they are already connected. See #1.4.2 for instructions.

Launch the memory server:

# check the CPU server and the memory server have been connected
dmesg | grep "frontswap module loaded"

# the output should be:
[Some timestamp] frontswap module loaded

2.2 Limit the memory resources of applications

MemLiner relies on cgroup to limit the memory usage of applications running on the CPU server. we are using cgroup version 1 here.

Create cgroup on the CPU server:

# Create a memory cgroup, memctl, for the applications running on the CPU server.
# $USER is the username of the account. It's "guest" here.
sudo cgcreate -t $USER -a $USER -g memory:/memctl

# Please confirm that a memory cgroup directory is built as:
/sys/fs/cgroup/memory/memctl

Limit local memory size on the CPU server. E.g., set local memory to 9GB:

# Please adjust the local memory size for different applications.
# e.g., for Spark with a 32GB Java heap. 25% local memory ratio means that we limit its CPU server memory size to 9GB.
# Application's working set includeds both Java heap and off-heap data, which is around 36GB in total. 
echo 9g > /sys/fs/cgroup/memory/memctl/memory.limit_in_bytes

FAQ

Question#1 Confirm the connection status of the CPU server and the memory server

Step 1: ensure that connection is already established.

# On CPU server
# Check RDMA connection between the CPU server and the memory server.
# search for connection built log by:
dmesg | grep "frontswap module loaded"

# If the output is:
[Some timestamp] frontswap module loaded
# Then the connection has been established.

If there is no connection, connect according to instructions on section 1.1.

Step 2: ensure that connection is still working.

Warning: Press ctrl+b, then press d to leave a tmux session. Don’t kill the process running.

# On memory server
# try attaching all tmux sessions. E.g., attach to the most recent session
tmux a

# If a command is still running and there's output like below, the connection is still active.
[...]
handle_cqe, 2-sided RDMA message sent done ?
handle_cqe, REQUEST_CHUNKS, Send available Regions to CPU server.
send_regions , Send registered Java heap to CPU server, 12 chunks.
send_message, message size = 248
handle_cqe, 2-sided RDMA message sent done ?

If the connection is not active, reboot both servers. After the reboot, connect according to instructions on section 1.1.

Question#2 Enable opensmd service in Ubuntu 18.04

Error message:

opensmd.service is not a native service, redirecting to systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable opensmd
update-rc.d: error: no runlevel symlinks to modify, aborting!

2.1 Update the service start level in /etc/init.d/opensmd

The original /etc/init.d/opensmd

  8 ### BEGIN INIT INFO
  9 # Provides: opensm
 10 # Required-Start: $syslog openibd
 11 # Required-Stop: $syslog openibd
 12 # Default-Start: null
 13 # Default-Stop: 0 1 6
 14 # Description:  Manage OpenSM
 15 ### END INIT INFO

Change the content in the line Default-start /etc/init.d/opensmd to :

12 # Default-Start: 2 3 4 5

2.2 Enable && Start the opensmd service

# Enable and strart the opensmd service
sudo update-rc.d opensmd remove -f
sudo systemctl enable opensmd
sudo systemctl start opensmd

# confirm the service status
sudo systemctl status opensmd

# The log shown as:
opensmd.service - LSB: Manage OpenSM
   Loaded: loaded (/etc/init.d/opensmd; generated)
   Active: active (running) since Mon 2022-05-02 14:53:39 CST; 10s ago
    

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •