You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -72,6 +72,8 @@ Accelerated Container Image is a __non-core__ sub-project of containerd.
72
72
73
73
* See the [PERFORMANCE](docs/PERFORMANCE.md) test about the acceleration.
74
74
75
+
* Enable 'record-trace' function can achieve higher performance for the entrypoint that needs to read amount of data at container startup. See [ENABLE_TRACE](docs/trace-prefetch.md).
76
+
75
77
* See how to convert OCI image into overlaybd with specified file system at [MULTI_FS_SUPPORT](docs/MULTI_FS_SUPPORT.md).
76
78
77
79
* See how to use layer deduplication for image conversion at [IMAGE_CONVERTOR](docs/IMAGE_CONVERTOR.md).
@@ -110,6 +111,11 @@ var recordTraceCommand = &cli.Command{
110
111
Usage: "record time in seconds. When time expires, a TERM signal will be sent to the task. The task might fail to respond signal if time is too short.",
111
112
Value: 60,
112
113
},
114
+
&cli.StringFlag{
115
+
Name: "priority_list",
116
+
Usage: "path of a file-list contains files to be prefetched",
117
+
Value: "",
118
+
},
113
119
&cli.StringFlag{
114
120
Name: "working-dir",
115
121
Value: "/tmp/ctr-record-trace/",
@@ -140,7 +146,12 @@ var recordTraceCommand = &cli.Command{
Copy file name to clipboardExpand all lines: docs/trace-prefetch.md
+34-7Lines changed: 34 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -8,15 +8,38 @@ There are many ways to do prefetch, for instance, we can simply read extra data
8
8
9
9
Another way is to [prioritize files and use landmarks](https://github.com/containerd/stargz-snapshotter/blob/master/docs/stargz-estargz.md#prioritized-files-and-landmark-files), which is already adopted in Google's stargz. The storage engine runtime will prefetch the range where prioritized files are contained. And finally this information will be leveraged for increasing cache hit ratio and mitigating read overhead.
10
10
11
-
In this article we are about to introduce a new prefetch mechanism based on time sequenced I/O patterns (trace). This mechanism has been integrated as a feature into `ctr record-trace` command.
11
+
In this article we are about to introduce two prefetch modes in overlayBD. One is to set prioritized files, another is a new prefetch mechanism based on time sequenced I/O patterns (trace).
12
+
These two mechanisms have been integrated as a feature into `ctr record-trace` command.
12
13
13
-
## Trace Prefetch
14
+
## Prefetch Mode
15
+
16
+
### Prioritize Files
17
+
18
+
Setting prioritized files is a simple way to improve container's cold start time. It is suitable for the condition where the target files needed be fully loaded.
19
+
20
+
When overlaybd device has been created, it will get prioritized files from the priority_list and analyze the filesystem via libext4 before mounting, then download the target files to overalybd's cache.
21
+
22
+
**Only support images based on EXT4 filesystem**
23
+
24
+
The priority list is a simple text file, each line contains a file path like follow:
25
+
```bash
26
+
## cat /tmp/priority_list.txt
27
+
/usr/bin/containerd
28
+
/usr/bin/nerdctl
29
+
/opt/cni/dhcp
30
+
/opt/cni/vlan
31
+
```
32
+
33
+
34
+
### Trace Prefetch
14
35
15
36
Since every single I/O request happens on user's own filesystem will eventually be mapped into one overlaybd's layer blob, we can then record all I/Os from the layer blob's perspective, and replay them later. That's why we call it Trace Prefetch.
16
37
17
38
Trace prefetch is time based, and it has greater granularity and predication accuracy than stargz. We don't mark a file, because user app might only need to read a small part of it in the beginning, simply prefetching the whole file would be less efficient. Instead, we replay the trace, by the exact I/O records that happened before. Each record contains only necessary information, such as the offset and length of the blob being read.
18
39
19
-
Trace is stored as an independent image layer, and MUST always be the uppermost one. Neither image manifest nor container snapshotter needs to know if it is a trace layer, snapshotter just downloads and extracts it as usual. The overlaybd backstore MUST recognize trace layer, and replay it accordingly.
40
+
**!! Note !!**
41
+
42
+
Both priority list and I/O trace are stored as an independent image layer, and MUST always be the uppermost one. Neither image manifest nor container snapshotter needs to know if it is a trace layer, snapshotter just downloads and extracts it as usual. The overlaybd backstore MUST recognize trace layer, and replay it accordingly.
20
43
21
44
## Terminology
22
45
@@ -42,14 +65,18 @@ After Recording and Pushing, users could pull and run the specific image somewhe
42
65
43
66
The example usage of building a new image with trace layer would be as follows:
Note the `old_image` must be in overlaybd format. A temporary container will be created and do the recording. The recording progress will be terminated by either timeout, or user signals.
79
+
Note the `<image>` must be in overlaybd format. A temporary container will be created and do the recording. The recording progress will be terminated by either timeout, or user signals.
53
80
54
81
Due to current limitations, this command might ask you remove the old image locally, in order to prepare a clean environment for the recording.
0 commit comments