Skip to contentSkip to conversation

Efficiently scan all objects in a rados pool/namespace

DISCUSSION Amit Tiwary 3 participants 5 messages Oct 16, 2013 – Oct 17, 2013

lore
Share & tools
lore
#0 lore raw

We are using ceph version 0.56.6, librados C++ APIs and have more than 750 million objects in a single pool. Objects are named as "domain-name_file- name".

We are unable to ascertain in what order objects are listed with the command "rados -p poolname ls". They are neither ordered on objectname, nor size or mtime.

Q1) Is there any way we can control the way objects are scanned/listed in a pool with the below librados c++ code? We are interested in getting list of objects sorted or grouped by object name

    librados::ObjectIterator it = ioctx.objects_begin();
    for (; it != ioctx.objects_end(); ++it)
        ...

Q2) In near future, if we upgrade and make use of namespaces (i.e make domain-name as namespace and store all objects of a particular domain in that namespace); would scanning of objects in a namespace be efficient than current scenario where we have to scan the entire pool to fetch all objects?

Q3) Do you any other recommendations on top of your mind that can improve time required to scan all objects of pool/namespace?

Thanks,
Amit Tiwary

#1 lore raw

The object is ordered by their hash code (from Object Name).

By default, the HashIndex is used to define the relation between Object Name and Local File Path, so you can find the details from HashIndex.cc::list_by_hash

Listing object means to scan the disk by current implementation, so maybe you should store the object list in other formats, they may be a certain object or centain objects which contain the object list or even another database(MySql).

Hope it is helpful.

Quoted 34 lines · Amit Tiwary

We are using ceph version 0.56.6, librados C++ APIs and have more than 750 million objects in a single pool. Objects are named as "domain-name_file- name".

We are unable to ascertain in what order objects are listed with the command "rados -p poolname ls". They are neither ordered on objectname, nor size or mtime.

Q1) Is there any way we can control the way objects are scanned/listed in a pool with the below librados c++ code? We are interested in getting list of objects sorted or grouped by object name

    librados::ObjectIterator it = ioctx.objects_begin();
    for (; it != ioctx.objects_end(); ++it)
        ...

Q2) In near future, if we upgrade and make use of namespaces (i.e make domain-name as namespace and store all objects of a particular domain in that namespace); would scanning of objects in a namespace be efficient than current scenario where we have to scan the entire pool to fetch all objects?

Q3) Do you any other recommendations on top of your mind that can improve time required to scan all objects of pool/namespace?

Thanks,
Amit Tiwary

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
Dong Yuan
Email:[email protected]
#2 lore raw
In reply to Amit Tiwary
Quoted 8 lines · Amit Tiwary

We are using ceph version 0.56.6, librados C++ APIs and have more than 750 million objects in a single pool. Objects are named as "domain-name_file- name".

We are unable to ascertain in what order objects are listed with the command "rados -p poolname ls". They are neither ordered on objectname, nor size or mtime.

Quoted 6 lines

Q1) Is there any way we can control the way objects are scanned/listed in a pool with the below librados c++ code? We are interested in getting list of objects sorted or grouped by object name

    librados::ObjectIterator it = ioctx.objects_begin();
    for (; it != ioctx.objects_end(); ++it)
        ...

They are ordered by hash(object name).

Quoted 4 lines

Q2) In near future, if we upgrade and make use of namespaces (i.e make domain-name as namespace and store all objects of a particular domain in that namespace); would scanning of objects in a namespace be efficient than current scenario where we have to scan the entire pool to fetch all objects?

The namespaces do not improve object listing efficiency; it is still O(size of the pool).

Quoted 2 lines

Q3) Do you any other recommendations on top of your mind that can improve time required to scan all objects of pool/namespace?

If you need efficient queries by name prefix (or whatever else) you need to maintain some sort of seperate index. Radosgw does this for the S3 interface by using key/value objects for each bucket. The kvstore class implements a btree on top of such objects to provide improved scalability.

Hope that helps!
sage

#3 lore raw
Quoted 3 lines · Sage Weil <sage <at> inktank.com> writes:
Quoted 1 line · Amit Tiwary

We are using ceph version 0.56.6, librados C++ APIs and have more than

750

Quoted 1 line
Quoted 1 line

million objects in a single pool. Objects are named as "domain-

name_file-

Quoted 3 lines
Quoted 3 lines

name".

We are unable to ascertain in what order objects are listed with the

command

Quoted 1 line
Quoted 1 line

"rados -p poolname ls". They are neither ordered on objectname, nor size

or

Quoted 3 lines
Quoted 3 lines

mtime.

Q1) Is there any way we can control the way objects are scanned/listed

in a

Quoted 1 line
Quoted 1 line

pool with the below librados c++ code? We are interested in getting list

of

Quoted 9 lines
Quoted 4 lines

objects sorted or grouped by object name

    librados::ObjectIterator it = ioctx.objects_begin();
    for (; it != ioctx.objects_end(); ++it)
        ...

They are ordered by hash(object name).

Quoted 2 lines

Q2) In near future, if we upgrade and make use of namespaces (i.e make domain-name as namespace and store all objects of a particular domain in

that

Quoted 2 lines
Quoted 2 lines

namespace); would scanning of objects in a namespace be efficient than current scenario where we have to scan the entire pool to fetch all

objects?

Quoted 5 lines

The namespaces do not improve object listing efficiency; it is still O(size of the pool).

Quoted 1 line

Q3) Do you any other recommendations on top of your mind that can

improve

Quoted 9 lines
Quoted 1 line

time required to scan all objects of pool/namespace?

If you need efficient queries by name prefix (or whatever else) you need to maintain some sort of seperate index. Radosgw does this for the S3 interface by using key/value objects for each bucket. The kvstore class implements a btree on top of such objects to provide improved scalability.

Hope that helps!
sage

Thanks Yuan and Sage. I feel namespace level stats would definitely be a good thing to have in future releases.

I have been lately following threads regarding optimal number of pools and I understand that increasing the number of pools increases memory footprint and can become a bottleneck.
Does number of objects or amount of data in each pool (i.e if number of objects or data is highly skewed in different pools) has any impact on performance of ceph.

#4 lore raw
Quoted 53 lines · Amit Tiwary
Quoted 3 lines · Sage Weil <sage <at> inktank.com> writes:
Quoted 1 line · Amit Tiwary

We are using ceph version 0.56.6, librados C++ APIs and have more than

750

Quoted 1 line
Quoted 1 line

million objects in a single pool. Objects are named as "domain-

name_file-

Quoted 3 lines
Quoted 3 lines

name".

We are unable to ascertain in what order objects are listed with the

command

Quoted 1 line
Quoted 1 line

"rados -p poolname ls". They are neither ordered on objectname, nor size

or

Quoted 3 lines
Quoted 3 lines

mtime.

Q1) Is there any way we can control the way objects are scanned/listed

in a

Quoted 1 line
Quoted 1 line

pool with the below librados c++ code? We are interested in getting list

of

Quoted 9 lines
Quoted 4 lines

objects sorted or grouped by object name

    librados::ObjectIterator it = ioctx.objects_begin();
    for (; it != ioctx.objects_end(); ++it)
        ...

They are ordered by hash(object name).

Quoted 2 lines

Q2) In near future, if we upgrade and make use of namespaces (i.e make domain-name as namespace and store all objects of a particular domain in

that

Quoted 2 lines
Quoted 2 lines

namespace); would scanning of objects in a namespace be efficient than current scenario where we have to scan the entire pool to fetch all

objects?

Quoted 5 lines

The namespaces do not improve object listing efficiency; it is still O(size of the pool).

Quoted 1 line

Q3) Do you any other recommendations on top of your mind that can

improve

Quoted 9 lines
Quoted 1 line

time required to scan all objects of pool/namespace?

If you need efficient queries by name prefix (or whatever else) you need to maintain some sort of seperate index. Radosgw does this for the S3 interface by using key/value objects for each bucket. The kvstore class implements a btree on top of such objects to provide improved scalability.

Hope that helps!
sage

Thanks Yuan and Sage. I feel namespace level stats would definitely be a good thing to have in future releases.

Quoted 6 lines

I have been lately following threads regarding optimal number of pools and I understand that increasing the number of pools increases memory footprint and can become a bottleneck.
Does number of objects or amount of data in each pool (i.e if number of objects or data is highly skewed in different pools) has any impact on performance of ceph.

In my opinion , there is no impact.

By default crush map, the pool distributes over all osds..

Quoted 6 lines

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
Dong Yuan
Email:[email protected]