-
Notifications
You must be signed in to change notification settings - Fork 123
Description
Is your feature request related to a problem? Please describe.
The filestream client waits for a request to fully complete before terminating the thread. This counts towards the concurrency limit. When streaming a large volume of files, and additionally not using/collecting Strelka events on the client side e.g. "Discard" mode, the client should not wait for events. This should vastly increase throughput for busy systems like network sensors.
Describe the solution you'd like
If the filestream client has no response entries in the config file (response: dict is emtpy), the client should immediately terminate the request after sending the file.
Describe alternatives you've considered
It may be possible to set the Filestream client timeout to a low threshold to quickly release waiting requests. However, that may negatively impact requests with large file sizes.
Additional context
Relevant code sections
strelka/src/go/cmd/strelka-filestream/main.go
Lines 80 to 107 in 0ca89f8
| sem := make(chan int, conf.Throughput.Concurrency) | |
| defer close(sem) | |
| // Create buffered channel to collect responses | |
| responses := make(chan *strelka.ScanResponse, 100) | |
| defer close(responses) | |
| // Set callback for completed requests, returning events | |
| wgResponse.Add(1) | |
| if conf.Response.Log != "" { | |
| go func() { | |
| rpc.LogResponses(responses, conf.Response.Log) | |
| wgResponse.Done() | |
| }() | |
| log.Printf("responses will be logged to %v", conf.Response.Log) | |
| } else if conf.Response.Report != 0 { | |
| go func() { | |
| rpc.ReportResponses(responses, conf.Response.Report) | |
| wgResponse.Done() | |
| }() | |
| log.Printf("responses will be reported every %v", conf.Response.Report) | |
| } else { | |
| go func() { | |
| rpc.DiscardResponses(responses) | |
| wgResponse.Done() | |
| }() | |
| log.Println("responses will be discarded") | |
| } |
Lines 195 to 208 in 0ca89f8
| // Wait for the response from the frontend containing the event | |
| for { | |
| resp, err := scanFile.Recv() | |
| if err == io.EOF { | |
| break | |
| } | |
| if err != nil { | |
| log.Println(errToMsg(err)) | |
| break | |
| } | |
| // Add the event to the responses channel | |
| responses <- resp | |
| } |