Skip to content

Conversation

@notoriaga
Copy link
Contributor

@notoriaga notoriaga commented Dec 10, 2021

With a 1mb file, before:

(base) {9:47}~/projects/console_pp:main ✗ ➭ time cargo fileio write ./test-file-1mb /persistent/steve.txt tcp 10.1.52.164 --port 55555
    Finished release [optimized + debuginfo] target(s) in 0.12s
     Running `target/release/fileio write ./test-file-1mb /persistent/steve.txt tcp 10.1.52.164 --port 55555`
Writing 100.00%...
File written successfully.
cargo fileio write ./test-file-1mb /persistent/steve.txt tcp 10.1.52.164    1.37s user 1.10s system 0% cpu 6:52.37 total

After:

(base) {9:38}~/projects/console_pp:steve/fileio-fix ✗ ➭ time cargo fileio write ./test-file-1mb /persistent/steve.txt tcp 10.1.52.164 --port 55555
    Finished release [optimized + debuginfo] target(s) in 0.17s
     Running `target/release/fileio write ./test-file-1mb /persistent/steve.txt tcp 10.1.52.164 --port 55555`
Writing 100.00%...
File written successfully (1048576 bytes).
cargo fileio write ./test-file-1mb /persistent/steve.txt tcp 10.1.52.164    0.55s user 0.36s system 1% cpu 57.986 total

I think the original was so slow because by not using the window_size we'd send writes for parts of the file that are really far apart causing a lot of seeking back and forth on the piksi's end, but not 100% sure.

@notoriaga notoriaga requested a review from a team December 13, 2021 17:56
let chunk_size = match chunk_sizes.lock().remove(&msg.sequence) {
Some(chunk_size) => chunk_size,
None => {
error!("unexpected message {:?}", msg);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Trying to think of scenarios where this may happen. If someone were to shoot off an upgrade process then additionally try to send a file to the device with the bin possibly? If the result was benign maybe debug would make more sense here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah that's sort of the scenario I was thinking of. Should be harmless if it happens so I'll downgrade it to a debug

.expect(THREAD_START_FAILURE);
scope
.builder()
.name("request-maker".into())
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is a great addition we should probably implement this throughout the app as well if we continue seeing reliability issues.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah it makes using gdb a bit easier. You can also set the stack size for the thread. The default is 2mb, we could probably shave a bit of memory usage off too by going thru and trying smaller sizes.

@notoriaga notoriaga merged commit 4683022 into main Dec 13, 2021
@notoriaga notoriaga deleted the steve/fileio-fix branch December 13, 2021 20:36
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