Libro sobre Proxmox maestria
Chapter 7
For better efficiency, we recommend a total of 50-100 PGs per OSD for all pools. Each PG will consume a certain number of node resources, such as CPUs and memory. A balanced distribution of PGs ensures that all nodes and OSDs in the nodes are not out of memory or that the CPU does not face overload issues. A simple formula to follow while allocating PG for a pool is as follows:
The result of the total PG should be rounded up to the nearest power of two. In a Ceph cluster with 3 nodes (replicas) and 24 OSDs, the total PG count should be as follows:
If we divide 800 by 24, which is the total number of OSDs, then we get 33.33. This is the number of PGs per replica per OSD. Since we have three replicas, we multiply 33.33 with 4 and get 99.99. This is the total number of PGs per OSD in the previous example. The formula will always calculate the PGs per replica. For a three-replica setup, each PG is written thrice. Thus, we multiplied 33.33 by 3 to get the total number of PGs per OSD.
Let's see another example to calculate PG. The following setup has 150 OSDs, three Ceph nodes, and two replicas:
If we divide 7500 by 150, the number of total OSDs, we get 50. Since we have two replicas, we multiply 50 by 2 and get 100. Thus, each OSD in this cluster can store 100 PGs. In both examples, our total PG per OSD was within the 50-100 recommended range. Always round up the PG value to remove any decimal point.
Pool
For in-depth details on Ceph PG, visit http://ceph.com/docs/ master/rados/operations/placement-groups/.
Pool is like a logical partition where Ceph stores data. When we set a PG or the number of replicas, we actually set them for each pool. When creating a Ceph cluster, three pools are created by default: data, metadata, and RBD. Data and metadata pools are used by the Ceph cluster, while the pool RBD is available to store actual user data. PGs are set on a per-pool basis. The formula discussed in the Placement Group (PG) section calculates the PGs required per pool. Thus, when creating multiple pools, it is important to slightly modify the formula so that the total PG stays within 50-100 per OSD.