Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize: bytes.Index and humanize.IBytes in SyncStandaloneReader #909

Open
wants to merge 5 commits into
base: v4
Choose a base branch
from

Conversation

cyningsun
Copy link

Opt:

  1. Replace bytes.Index with bytes.Equal between lastBytes and EOF MARKER
  2. Move humanize from every write to stats print

Before:
image

After:
image

@EquentR
Copy link
Collaborator

EquentR commented Dec 25, 2024

Here's a question: Will doing this make the status interface unable to retrieve the humanized result? What if I want to view the status? In pkg: internal/status

@cyningsun
Copy link
Author

cyningsun commented Dec 25, 2024

Currently Interface Statusable retrieve the humanized result only by method StatusString(). And StatusString can convert those stats to humanized result when called instead of calculated those stats to humanized result after every writing to rdb

@EquentR
Copy link
Collaborator

EquentR commented Dec 25, 2024

Currently Interface Statusable retrieve the humanized result only by method StatusString(). And StatusString can convert those stats to humanized result when called instead of calculated those stats to humanized result after every writing to rdb

No no, you look at the Statusable interface, in the json result obtained using the web interface, the Status func is used to generate json result!

@EquentR
Copy link
Collaborator

EquentR commented Dec 25, 2024

image

@cyningsun
Copy link
Author

cyningsun commented Dec 25, 2024

Got it. Will check and fix it.

@cyningsun
Copy link
Author

@EquentR Issue resolved.

@EquentR
Copy link
Collaborator

EquentR commented Dec 26, 2024

@suxb201 看一下,好像是能提高一点点性能的样子

internal/reader/sync_standalone_reader.go Show resolved Hide resolved
internal/reader/sync_standalone_reader.go Outdated Show resolved Hide resolved
internal/reader/sync_standalone_reader.go Show resolved Hide resolved
Copy link
Member

@suxb201 suxb201 left a comment

Choose a reason for hiding this comment

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

你是正确的

        /* If this was a diskless replication, we need to really put
         * the slave online when the first ACK is received (which
         * confirms slave is online and ready to get more data). */
        if (c->repl_put_online_on_ack && c->replstate == SLAVE_STATE_ONLINE)
            putSlaveOnline(c);

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