Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[REQUEST] Make Filestream Client Requests With No Logging Asynchronous #398

@ryanohoro

Description

@ryanohoro

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

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")
}

// 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
}

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions