Skip to content

Conversation

@RebeccaMahany
Copy link
Contributor

@RebeccaMahany RebeccaMahany commented Sep 29, 2025

Benchmarking our current implementation against qusers and using LSA showed that using LSA is the most performant option for us:

(becca/consoleusers-alternatives-evaluate)
$ go test -v -bench=.
=== RUN   TestCurrentUids
=== PAUSE TestCurrentUids
=== CONT  TestCurrentUids
--- PASS: TestCurrentUids (0.01s)
goos: windows
goarch: amd64
pkg: github.com/kolide/launcher/ee/consoleuser
cpu: 12th Gen Intel(R) Core(TM) i5-1235U
BenchmarkCurrentUids
BenchmarkCurrentUids-12                      100          10311775 ns/op        18467225 B/op       1791 allocs/op
BenchmarkCurrentUidsViaQuser
BenchmarkCurrentUidsViaQuser-12               76          13532111 ns/op           36786 B/op        281 allocs/op
BenchmarkCurrentUidsViaLsa
BenchmarkCurrentUidsViaLsa-12               1974            694522 ns/op            5920 B/op         81 allocs/op
PASS
ok      github.com/kolide/launcher/ee/consoleuser       4.110s

Requires kolide/go-winlsa#2.

@RebeccaMahany RebeccaMahany force-pushed the becca/consoleusers-alternatives-evaluate branch from 3fb37c8 to d673e3f Compare September 29, 2025 20:51
@RebeccaMahany RebeccaMahany changed the title Evaluate alternatives to consoleusers on Windows Use LSA to determine console users on Windows Sep 30, 2025
Copy link
Contributor

@directionless directionless left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should fork winlsa before merging

@RebeccaMahany RebeccaMahany marked this pull request as ready for review October 3, 2025 21:11
Comment on lines 61 to 65
activeUsernameList := make([]string, len(activeUsernames))
i := 0
for sid := range activeUsernames {
activeUsernameList[i] = sid
i += 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this just map.Keys?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess thats an iter. Not sure if it would just work though

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated!

zackattack01
zackattack01 previously approved these changes Oct 8, 2025
activeUsernameList[i] = sid
i += 1
}
activeUsernameList := slices.Collect(maps.Keys(activeUsernames))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we could have changed the signature to iter, instead of bringing in slices.Collect, but sure.

@directionless directionless added this pull request to the merge queue Oct 10, 2025
Merged via the queue into kolide:main with commit fe6f09a Oct 10, 2025
36 checks passed
@RebeccaMahany RebeccaMahany deleted the becca/consoleusers-alternatives-evaluate branch October 13, 2025 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants