Skip to content

osd: compress data in recovery process#3303

Closed
XinzeChi wants to merge 1 commit intoceph:masterfrom
XinzeChi:wip-push-compress
Closed

osd: compress data in recovery process#3303
XinzeChi wants to merge 1 commit intoceph:masterfrom
XinzeChi:wip-push-compress

Conversation

@XinzeChi
Copy link
Contributor

@XinzeChi XinzeChi commented Jan 7, 2015

Ceph may run out of network bandwith in recovery process, compress data if needed.

By default, I will use lz4. Maybe we can shoose any compression algorithm by user as ec pools does.

To run of my patch, First of all, we should install lz4 from https://code.google.com/p/lz4/.

Signed-off-by: Xinze Chi xmdxcxz@gmail.com

@XinzeChi XinzeChi force-pushed the wip-push-compress branch 2 times, most recently from fbcb1ca to 5294e4f Compare January 7, 2015 03:44
@loic-bot
Copy link

loic-bot commented Jan 7, 2015

FAIL: the output of run-make-check.sh on bcb0269 is http://paste.pound-python.org/

:octocat: Sent from GH.

@liewegas
Copy link
Member

liewegas commented Jan 7, 2015

This is pretty interesting! Mostly because it is so simple. Several comments, but I think we should discuss the best compression strategy before investing too much time to make sure we take the right approach.

Copy link
Member

Choose a reason for hiding this comment

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

this allocates, decompresses, copies, then deallocates. Instead, you can do

bufferptr bp = buffer::create_page_aligned(max_compressed_size);
uint32_t actual = LZ4_compress(pch_src, bp.c_str(), input_size);
bp.set_len(actual);
dest.append(bp);
to avoid the copy. we will allocate more memory than we need, which isn't ideal, but probably good enough for now.

@liewegas
Copy link
Member

liewegas commented Jan 7, 2015

I wonder if, instead of doing this specifically for recovery, we should do it as a generic feature of the messenger wire protocol. Then we could compress all messages that pass over the wire. Is there any reason not to go this route?

@XinzeChi
Copy link
Contributor Author

XinzeChi commented Jan 7, 2015

@liewegas, becasuse in recover process, ceph will write 4M object each time. So the network bandwith is bottleneck insteand of cpu in 1000Mbits environment . We can compress data using a little cpu resource to speed up the recover process.

In normal 4k write scene, maybe cpu resource is bottleneck, I think we should consider.

@yuyuyu101
Copy link
Member

Good commit. Agree with sage, it would better let "compress" feature become a impl of Messenger? So caller can call "send_message(m, COMPRESS_FLAGS)" depends on caller config value or let Messenger make a smart decision according to message?

@XinzeChi
Copy link
Contributor Author

XinzeChi commented Jan 7, 2015

@yuyuyu101, this also looks good to me.

@loic-bot
Copy link

loic-bot commented Jan 7, 2015

FAIL: the output of run-make-check.sh on 40987d9 is http://paste.pound-python.org/show/4MvE2sUiC38Yf5w1dqkt/

:octocat: Sent from GH.

@loic-bot
Copy link

loic-bot commented Jan 9, 2015

FAIL: the output of run-make-check.sh on 9b0a050 is http://paste.pound-python.org/show/CyEYmkl5wViXlUxqw82E/

:octocat: Sent from GH.

@ghost
Copy link

ghost commented Jan 9, 2015

common/buffer.cc:34:17: fatal error: lz4.h: No such file or directory
#include "lz4.h"
^
compilation terminated. 

You need to add the dependency (lz4.h package) to debian/control and ceph.spec.in also.

ceph maybe run out of network bandwith in recovery process,
compress data if needed.

Signed-off-by: Xinze Chi <xmdxcxz@gmail.com>
@athanatos
Copy link
Contributor

Since we have to create new buffers anyway, I'd prefer that compress and decompress returned new buffer::list's.

@athanatos
Copy link
Contributor

Should there be a size threshold for compression? Actually, with small objects, we tend to combine a bunch of Pushes, so we might want to compress after that. In fact, I think Sage is right, we should add machinery at the Messenger level to allow us to tag Messages as suitable for compression. Perhaps a

bool should_compress() const { return false; }

in the message interface which Push messages might return true for.

@cchengleo
Copy link
Contributor

I am wondering should we set compression preference on OSD bases? For example, if communicating with a remote OSD, we can compress all messages since the bandwidth is limited.

@XinzeChi
Copy link
Contributor Author

XinzeChi commented Feb 5, 2015

See #3490

@XinzeChi XinzeChi closed this Feb 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants