Skip to content

Commit

Permalink
Fix max map count (#79)
Browse files Browse the repository at this point in the history
Add a fix for max map count.
  • Loading branch information
antejavor authored Nov 28, 2024
1 parent f6e7f38 commit 4f174b9
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 35 deletions.
66 changes: 34 additions & 32 deletions charts/memgraph-high-availability/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,41 +38,43 @@ The affinity is disabled either by running the command above, or by modifying th

The following table lists the configurable parameters of the Memgraph chart and their default values.

| Parameter | Description | Default |
|---------------------------------------------|-----------------------------------------------------------------------------------------------------|-----------------------------------------|
| `memgraph.image.repository` | Memgraph Docker image repository | `memgraph/memgraph` |
| `memgraph.image.tag` | Specific tag for the Memgraph Docker image. Overrides the image tag whose default is chart version. | `2.17.0` |
| `memgraph.image.pullPolicy` | Image pull policy | `IfNotPresent` |
| `memgraph.env.MEMGRAPH_ENTERPRISE_LICENSE` | Memgraph enterprise license | `<your-license>` |
| `memgraph.env.MEMGRAPH_ORGANIZATION_NAME` | Organization name | `<your-organization-name>` |
| `memgraph.probes.startup.failureThreshold` | Startup probe failure threshold | `30` |
| `memgraph.probes.startup.periodSeconds` | Startup probe period in seconds | `10` |
| `memgraph.probes.readiness.initialDelaySeconds` | Readiness probe initial delay in seconds | `5` |
| `memgraph.probes.readiness.periodSeconds` | Readiness probe period in seconds | `5` |
| `memgraph.probes.liveness.initialDelaySeconds` | Liveness probe initial delay in seconds | `30` |
| `memgraph.probes.liveness.periodSeconds` | Liveness probe period in seconds | `10` |
| `memgraph.data.volumeClaim.storagePVC` | Enable storage PVC | `true` |
| `memgraph.data.volumeClaim.storagePVCSize` | Size of the storage PVC | `1Gi` |
| `memgraph.data.volumeClaim.logPVC` | Enable log PVC | `false` |
| `memgraph.data.volumeClaim.logPVCSize` | Size of the log PVC | `256Mi` |
| `memgraph.coordinators.volumeClaim.storagePVC` | Enable storage PVC for coordinators | `true` |
| `memgraph.coordinators.volumeClaim.storagePVCSize` | Size of the storage PVC for coordinators | `1Gi` |
| `memgraph.coordinators.volumeClaim.logPVC` | Enable log PVC for coordinators | `false` |
| `memgraph.coordinators.volumeClaim.logPVCSize` | Size of the log PVC for coordinators | `256Mi` |
| `memgraph.affinity.enabled` | Enables affinity so each instance is deployed to unique node | `true` |
| `data` | Configuration for data instances | See `data` section |
| `coordinators` | Configuration for coordinator instances | See `coordinators` section |
| Parameter | Description | Default |
| -------------------------------------------------- | --------------------------------------------------------------------------------------------------- | -------------------------- |
| `memgraph.image.repository` | Memgraph Docker image repository | `memgraph/memgraph` |
| `memgraph.image.tag` | Specific tag for the Memgraph Docker image. Overrides the image tag whose default is chart version. | `2.17.0` |
| `memgraph.image.pullPolicy` | Image pull policy | `IfNotPresent` |
| `memgraph.env.MEMGRAPH_ENTERPRISE_LICENSE` | Memgraph enterprise license | `<your-license>` |
| `memgraph.env.MEMGRAPH_ORGANIZATION_NAME` | Organization name | `<your-organization-name>` |
| `memgraph.probes.startup.failureThreshold` | Startup probe failure threshold | `30` |
| `memgraph.probes.startup.periodSeconds` | Startup probe period in seconds | `10` |
| `memgraph.probes.readiness.initialDelaySeconds` | Readiness probe initial delay in seconds | `5` |
| `memgraph.probes.readiness.periodSeconds` | Readiness probe period in seconds | `5` |
| `memgraph.probes.liveness.initialDelaySeconds` | Liveness probe initial delay in seconds | `30` |
| `memgraph.probes.liveness.periodSeconds` | Liveness probe period in seconds | `10` |
| `memgraph.data.volumeClaim.storagePVC` | Enable storage PVC | `true` |
| `memgraph.data.volumeClaim.storagePVCSize` | Size of the storage PVC | `1Gi` |
| `memgraph.data.volumeClaim.logPVC` | Enable log PVC | `false` |
| `memgraph.data.volumeClaim.logPVCSize` | Size of the log PVC | `256Mi` |
| `memgraph.coordinators.volumeClaim.storagePVC` | Enable storage PVC for coordinators | `true` |
| `memgraph.coordinators.volumeClaim.storagePVCSize` | Size of the storage PVC for coordinators | `1Gi` |
| `memgraph.coordinators.volumeClaim.logPVC` | Enable log PVC for coordinators | `false` |
| `memgraph.coordinators.volumeClaim.logPVCSize` | Size of the log PVC for coordinators | `256Mi` |
| `memgraph.affinity.enabled` | Enables affinity so each instance is deployed to unique node | `true` |
| `data` | Configuration for data instances | See `data` section |
| `coordinators` | Configuration for coordinator instances | See `coordinators` section |
| `sysctlInitContainer.enabled` | Enable the init container to set sysctl parameters | `true` |
| `sysctlInitContainer.maxMapCount` | Value for `vm.max_map_count` to be set by the init container | `262144` |

For the `data` and `coordinators` sections, each item in the list has the following parameters:

| Parameter | Description | Default |
|---------------------------------------------|-----------------------------------------------------------------------------------------------------|-----------------------------------------|
| `id` | ID of the instance | `0` for data, `1` for coordinators |
| `boltPort` | Bolt port of the instance | `7687` |
| `managementPort` | Management port of the data instance | `10000` |
| `replicationPort` (data only) | Replication port of the data instance | `20000` |
| `coordinatorPort` (coordinators only) | Coordinator port of the coordinator instance | `12000` |
| `args` | List of arguments for the instance | See `args` section |
| Parameter | Description | Default |
| ------------------------------------- | -------------------------------------------- | ---------------------------------- |
| `id` | ID of the instance | `0` for data, `1` for coordinators |
| `boltPort` | Bolt port of the instance | `7687` |
| `managementPort` | Management port of the data instance | `10000` |
| `replicationPort` (data only) | Replication port of the data instance | `20000` |
| `coordinatorPort` (coordinators only) | Coordinator port of the coordinator instance | `12000` |
| `args` | List of arguments for the instance | See `args` section |

The `args` section contains a list of arguments for the instance. The default values are the same for all instances:

Expand Down
9 changes: 9 additions & 0 deletions charts/memgraph-high-availability/templates/coordinators.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@ spec:
add: [ "CHOWN" ]
runAsUser: 0
runAsNonRoot: false
{{- if $.Values.sysctlInitContainer.enabled }}
- name: init-sysctl
image: busybox
command: ['sh', '-c', 'sysctl -w vm.max_map_count={{ $.Values.sysctlInitContainer.maxMapCount }}']
securityContext:
privileged: true
runAsUser: 0
{{- end }}

containers:
- name: memgraph-coordinator
image: "{{ $.Values.memgraph.image.repository }}:{{ $.Values.memgraph.image.tag }}"
Expand Down
9 changes: 9 additions & 0 deletions charts/memgraph-high-availability/templates/data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@ spec:
add: [ "CHOWN" ]
runAsUser: 0
runAsNonRoot: false
{{- if $.Values.sysctlInitContainer.enabled }}
- name: init-sysctl
image: busybox
command: ['sh', '-c', 'sysctl -w vm.max_map_count={{ $.Values.sysctlInitContainer.maxMapCount }}']
securityContext:
privileged: true
runAsUser: 0
{{- end }}

containers:
- name: memgraph-data
image: "{{ $.Values.memgraph.image.repository }}:{{ $.Values.memgraph.image.tag }}"
Expand Down
7 changes: 7 additions & 0 deletions charts/memgraph-high-availability/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ memgraph:
affinity:
enabled: true

# If you are experiencing issues with the sysctlInitContainer, you can disable it here.
# This is made to increase the max_map_count, necessary for high memory loads in Memgraph
# If you are experiencing crashing pod with the: Max virtual memory areas vm.max_map_count is too low
# you can increase the maxMapCount value.
sysctlInitContainer:
enabled: true
maxMapCount: 262144

data:
- id: "0"
Expand Down
3 changes: 2 additions & 1 deletion charts/memgraph/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ The following table lists the configurable parameters of the Memgraph chart and
| `probes.startup.failureThreshold` | Failure threshold for startup probe | `30` |
| `nodeSelectors` | Node selectors for pod. Left empty by default. | `{}` |
| `customQueryModules` | List of custom Query modules that should be mounted to Memgraph Pod | `[]` |

| `sysctlInitContainer.enabled` | Enable the init container to set sysctl parameters | `true` |
| `sysctlInitContainer.maxMapCount` | Value for `vm.max_map_count` to be set by the init container | `262144` |
**Note:** It's often recommended not to specify default resources and leave it as a conscious choice for the user. If you want to specify resources, uncomment the following lines in your `values.yaml`, adjust them as necessary:

```yaml
Expand Down
9 changes: 8 additions & 1 deletion charts/memgraph/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,14 @@ spec:
add: ["CHOWN"]
runAsUser: 0
runAsNonRoot: false

{{- if .Values.sysctlInitContainer.enabled }}
- name: init-sysctl
image: busybox
command: ['sh', '-c', 'sysctl -w vm.max_map_count={{ .Values.sysctlInitContainer.maxMapCount }}']
securityContext:
privileged: true
runAsUser: 0
{{- end }}
terminationGracePeriodSeconds: {{ .Values.container.terminationGracePeriodSeconds }}
securityContext:
{{- if .Values.useImagePullSecrets }}
Expand Down
11 changes: 10 additions & 1 deletion charts/memgraph/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ affinity:
nodeKey:
nodeValue:


nodeSelector: {}

tolerations: []
Expand Down Expand Up @@ -120,7 +121,6 @@ serviceAccount:
# If not set and create is true, a name is generated using the fullname template
name: ""


container:
terminationGracePeriodSeconds: 1800
probes:
Expand All @@ -145,3 +145,12 @@ customQueryModules: []
# - volume: ""
# Must be present in the ConfigMap referenced with `volume`
# file: ""


# If you are experiencing issues with the sysctlInitContainer, you can disable it here.
# This is made to increase the max_map_count, necessary for high memory loads in Memgraph
# If you are experiencing crashing pod with the: Max virtual memory areas vm.max_map_count is too low
# you can increase the maxMapCount value.
sysctlInitContainer:
enabled: true
maxMapCount: 262144

0 comments on commit 4f174b9

Please sign in to comment.