The DDS_ResourceLimitsQosPolicy::max_samples resource-limit limits the maximum number of samples a DDS_DataReader can allocate and cache. Samples are cached before they are made available to the application, for example when samples are received out-of-order. Thus, this resource-limit may impact throughput and latency.
What this value should be set to is determined by a number of factors:
For best-effort it can be set to 1 since samples are not cached. However, if data is polled or samples are loaned longer than the update frequency this resource-limit should be increased to prevent samples from being reused before the application has a chance to access the data (along with DDS_HistoryQosPolicy::depth).
For reliable data the value should take into account the data-rate, the heartbeat rate of the DDS_DataWriter and the number of piggy-backed heartbeats.