Replies: 3 comments 2 replies
-
Hi @nsoubelet, Congratulations for openning the very first discussion topic for nfs4j project! We don't have any kind of limits implemented. I general, can you elaborate what you expect by those limits? DoS attack protection from single use? Or IP? Or specific operation? Or only IO? Should be this a hard limit, or fare-share? Any of mentioned cases can be solved on different levels: RPC, NFS, VFS. Thanks a lot for quite exciting subjec. Welcome to discussions! |
Beta Was this translation helpful? Give feedback.
-
Hello @kofemann, many thanks for such a nice welcome! Regarding the question, let me elaborate a bit. I originally said IOPs, but thinking carefully about it what I really need to achieve is a combination of things, that is, IOPs and Throughput. However, and this is the difficult part, I don't really want to reject operations when those accumulators reach the threshold (before they are reset) but slow operations down. I presume there is not such a thing in Many thanks! |
Beta Was this translation helpful? Give feedback.
-
Hi @nsoubelet, I think those are two different limits that have to be addressed. Thus I don't think you can address it in one go. Moreover, a per-client limiting mechanism will be a nice addition to protect regular clients from a greedy one. To address general IOPS limits the simplest way will be to handle it at the RPC level. A stupid implementation can be as following: import java.util.concurrent.ThreadPoolExecutor;
import com.google.common.util.concurrent.RateLimiter;
public class RateLimitingExecutor extends ThreadPoolExecutor {
private final RateLimiter limiter;
public RateLimitingExecutor(double rps, ...) {
super(...);
limiter = RateLimiter.create(rps);
}
@Override
protected void beforeExecute(Thread t, Runnable r) {
super.beforeExecute(t, r);
limiter.acquire();
}
} and configure RPC later to use worker thread pool with given rate limit: OncRpcSvc nfsSvc =
new OncRpcSvcBuilder()
.withPort(2049)
.withTCP()
.withAutoPublish()
.withWorkerThreadExecutionService( new RateLimitingExecutor(5000.0, ...))
.build(); A more sophisticated solution should use adaptive thread pool that will dynamically adjust limits based on response time. I had a look at https://github.com/Netflix/concurrency-limits, but had no time to play with it. I am pretty sure that both solutions can be applied to IO bandwidth in the file system itself. The Does it makes sense? |
Beta Was this translation helpful? Give feedback.
-
Hello guys,
It seems like I am the first one writing something in this discussions section, so I hope it is welcomed to you.
I would like to ask for your help with the following question: is it currently possible to limit IOPS from this lib (
NFSServerV41
)?I know I could do that directly in the underlying
VirtualFileSystem
implementation, but I do not want to reinvent it if it was already implemented.Many thanks!
Beta Was this translation helpful? Give feedback.
All reactions