Skip to contentSkip to conversation

advice on indexing sequential data?

DISCUSSION Tom Nakamura 4 participants 6 messages Oct 1, 2015 – Oct 2, 2015 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

Hello ceph-devel,

My lab is concerned with developing data mining application for detecting and 'deanonymizing' spamming botnets from high-volume spam feeds.

Currently, we just store everything in large mbox files in directories separated by day (think: /data/feed1/2015/09/13.mbox) on a single NFS server. We have ad-hoc scripts to extract features from these mboxes and pass them to our analysis pipelines (written in a mixture of R/matlab/python/etc). This system is reaching its limit point.

We already have a small Ceph installation with which we've had good luck for storing other data,and would like to see how we can use it to solve our mail problem. Our basic requirements are that:

- We need to be able to access each message by its extracted features. These features include simple information found in its header (for example From: and To:) as well as more complex information like signatures from attachments and network information (for example, presence in blacklists).
- We will frequently add/remove features.
- Faster access to recent data is more important than to older data.
- Maintaining strict ordering of incoming messages is not necessary. In other words, if we received two spam messages on our feeds, it doesn't matter too much if they are stored in that order, as long as we can have coarse-grained temporal accuracy (say, 5 minutes). So we don't need anything as sophisticated as Zlog.
- We need to be able to remove messages older than some specific age, due to storage constraints.

Any advice on how to use Ceph and librados to accomplish this? Here are my initial thoughts:

- Each message is an object with some unique ID. Use omap to store all its features in the same object.
- For each time period (which will have to be pre-specified to, say, an hour), we have an object which contains a list of ID's, as a bytestring of contatenated ID's. This should make expiring old messages trivial.
- For each feature, we have a timestamped index (like [email protected] or 20150813-has-attachment-with-hash-123abddeadbeef) the which contains a list of ID's.
- Hopefully use Rados classes to index/feature-extract on the OSD's.

How does this sound? One glaring omission is that I do not know how to create indices which would support querying by inequality/ranges ('find all messages between 1000 and 2000 bytes').

Thank you,
Tom N.

A message that is not in the archive (sent off-list or not yet received): CACJqLybNJaTtcf2K3nvNasawPbJ0Ce3F4VoeK+J+MvtcpbxFuw@mail.gmail.com

#2 lore raw

resend

Quoted 80 lines · Haomai Wang
Quoted 46 lines · Tom Nakamura

Hello ceph-devel,

My lab is concerned with developing data mining application for detecting and 'deanonymizing' spamming botnets from high-volume spam feeds.

Currently, we just store everything in large mbox files in directories separated by day (think: /data/feed1/2015/09/13.mbox) on a single NFS server. We have ad-hoc scripts to extract features from these mboxes and pass them to our analysis pipelines (written in a mixture of R/matlab/python/etc). This system is reaching its limit point.

We already have a small Ceph installation with which we've had good luck for storing other data,and would like to see how we can use it to solve our mail problem. Our basic requirements are that:

- We need to be able to access each message by its extracted features. These features include simple information found in its header (for example From: and To:) as well as more complex information like signatures from attachments and network information (for example, presence in blacklists).
- We will frequently add/remove features.
- Faster access to recent data is more important than to older data.
- Maintaining strict ordering of incoming messages is not necessary. In other words, if we received two spam messages on our feeds, it doesn't matter too much if they are stored in that order, as long as we can have coarse-grained temporal accuracy (say, 5 minutes). So we don't need anything as sophisticated as Zlog.
- We need to be able to remove messages older than some specific age, due to storage constraints.

Any advice on how to use Ceph and librados to accomplish this? Here are my initial thoughts:

- Each message is an object with some unique ID. Use omap to store all its features in the same object.
- For each time period (which will have to be pre-specified to, say, an hour), we have an object which contains a list of ID's, as a bytestring of contatenated ID's. This should make expiring old messages trivial.
- For each feature, we have a timestamped index (like [email protected] or 20150813-has-attachment-with-hash-123abddeadbeef) the which contains a list of ID's.
- Hopefully use Rados classes to index/feature-extract on the OSD's.

Quoted 3 lines

How does this sound? One glaring omission is that I do not know how to create indices which would support querying by inequality/ranges ('find all messages between 1000 and 2000 bytes').

I guess it likes label in Gmail?

Hmm, each message as a object is a luxurious way. I guess we need to have a primary index, which could used to combine multi messages into one rados object and store offset/len mapping to omap/xattr. Then Secondary index also can store as object, omap is used to refer to actual data.

Quoted 8 lines

Thank you,
Tom N.
--
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

--

Best Regards,

Wheat

Signature · 3 lines
Best Regards,

Wheat
#3 lore raw
In reply to Tom Nakamura

Hi Tom,

Quoted 31 lines · Tom Nakamura

Hello ceph-devel,

My lab is concerned with developing data mining application for detecting and 'deanonymizing' spamming botnets from high-volume spam feeds.

Currently, we just store everything in large mbox files in directories separated by day (think: /data/feed1/2015/09/13.mbox) on a single NFS server. We have ad-hoc scripts to extract features from these mboxes and pass them to our analysis pipelines (written in a mixture of R/matlab/python/etc). This system is reaching its limit point.

We already have a small Ceph installation with which we've had good luck for storing other data,and would like to see how we can use it to solve our mail problem. Our basic requirements are that:

- We need to be able to access each message by its extracted features. These features include simple information found in its header (for example From: and To:) as well as more complex information like signatures from attachments and network information (for example, presence in blacklists).
- We will frequently add/remove features.
- Faster access to recent data is more important than to older data.
- Maintaining strict ordering of incoming messages is not necessary. In other words, if we received two spam messages on our feeds, it doesn't matter too much if they are stored in that order, as long as we can have coarse-grained temporal accuracy (say, 5 minutes). So we don't need anything as sophisticated as Zlog.
- We need to be able to remove messages older than some specific age, due to storage constraints.

Quoted 8 lines

Any advice on how to use Ceph and librados to accomplish this? Here are my initial thoughts:

- Each message is an object with some unique ID. Use omap to store all its features in the same object.
- For each time period (which will have to be pre-specified to, say, an hour), we have an object which contains a list of ID's, as a bytestring of contatenated ID's. This should make expiring old messages trivial.

This seems reasonable. There's a rados append operation so you can fire off 2 IOs to write the message and do the append. You may want to batch the appends on the inject process to reduce load... or it might not matter, depends on the data rate.

You could also use omap for this if you wan to query by time range (within the per-day or per-hour object).

Quoted 9 lines

- For each feature, we have a timestamped index (like [email protected] or 20150813-has-attachment-with-hash-123abddeadbeef) the which contains a list of ID's.
- Hopefully use Rados classes to index/feature-extract on the OSD's.

How does this sound? One glaring omission is that I do not know how to create indices which would support querying by inequality/ranges ('find all messages between 1000 and 2000 bytes').

This I'm less sure about. You could use a rados class to do teh feature extraction and store in omap in the same object, but rados doesn't give you a cross-object index. If you are going to do any queries I would put it in a database of some sort (maybe something like cassandra or hbase?).

sage

#4 lore raw

Hi Sage,
Thank you for the reply,

Quoted 6 lines · Sage Weil
Quoted 5 lines

- Each message is an object with some unique ID. Use omap to store all its features in the same object.
- For each time period (which will have to be pre-specified to, say, an hour), we have an object which contains a list of ID's, as a bytestring of contatenated ID's. This should make expiring old messages trivial.

Quoted 8 lines

This seems reasonable. There's a rados append operation so you can fire off 2 IOs to write the message and do the append. You may want to batch the appends on the inject process to reduce load... or it might not matter, depends on the data rate.

You could also use omap for this if you wan to query by time range (within the per-day or per-hour object).

What do mean by this exactly? Is there a way to use timestamps as keys and query them by range? That would be very useful, but I don't see anything like that in the librados api. (I see rados_read_op_omap_cmp, which seems to be for comparing values, and not keys?)

Quoted 10 lines
Quoted 9 lines

- For each feature, we have a timestamped index (like [email protected] or 20150813-has-attachment-with-hash-123abddeadbeef) the which contains a list of ID's.
- Hopefully use Rados classes to index/feature-extract on the OSD's.

How does this sound? One glaring omission is that I do not know how to create indices which would support querying by inequality/ranges ('find all messages between 1000 and 2000 bytes').

Quoted 5 lines

This I'm less sure about. You could use a rados class to do teh feature extraction and store in omap in the same object, but rados doesn't give you a cross-object index. If you are going to do any queries I would put it in a database of some sort (maybe something like cassandra or hbase?).

That seems like a very good idea-- using either of those would give us the ability to connect Spark or similar tool. Only disadvantage would be that there would be two components which would need to be synchronized, though that in itself sounds like an interesting research topic. I will report back when I've tried it.

Thank you,
Tom

#5 lore raw
Quoted 15 lines · Tom Nakamura

Hi Sage,
Thank you for the reply,

Quoted 11 lines · Sage Weil
Quoted 5 lines

- Each message is an object with some unique ID. Use omap to store all its features in the same object.
- For each time period (which will have to be pre-specified to, say, an hour), we have an object which contains a list of ID's, as a bytestring of contatenated ID's. This should make expiring old messages trivial.

This seems reasonable. There's a rados append operation so you can fire off 2 IOs to write the message and do the append. You may want to batch the appends on the inject process to reduce load... or it might not matter, depends on the data rate.

Quoted 8 lines
Quoted 3 lines

You could also use omap for this if you wan to query by time range (within the per-day or per-hour object).

What do mean by this exactly? Is there a way to use timestamps as keys and query them by range? That would be very useful, but I don't see anything like that in the librados api. (I see rados_read_op_omap_cmp, which seems to be for comparing values, and not keys?)

https://github.com/ceph/ceph/blob/master/src/include/rados/librados.hpp#L474

The omap enumeration APIs let you specify a starting point (key name). There's also a variant that lets you specify a prefix to match, and one that only returns keys (not k/v pairs).

Quoted 16 lines
Quoted 10 lines
Quoted 9 lines

- For each feature, we have a timestamped index (like [email protected] or 20150813-has-attachment-with-hash-123abddeadbeef) the which contains a list of ID's.
- Hopefully use Rados classes to index/feature-extract on the OSD's.

How does this sound? One glaring omission is that I do not know how to create indices which would support querying by inequality/ranges ('find all messages between 1000 and 2000 bytes').

Quoted 5 lines

This I'm less sure about. You could use a rados class to do teh feature extraction and store in omap in the same object, but rados doesn't give you a cross-object index. If you are going to do any queries I would put it in a database of some sort (maybe something like cassandra or hbase?).

Quoted 5 lines

That seems like a very good idea-- using either of those would give us the ability to connect Spark or similar tool. Only disadvantage would be that there would be two components which would need to be synchronized, though that in itself sounds like an interesting research topic. I will report back when I've tried it.

Good luck!
sage

#6 lore raw
In reply to Tom Nakamura
Quoted 45 lines · Tom Nakamura

Hello ceph-devel,

My lab is concerned with developing data mining application for detecting and 'deanonymizing' spamming botnets from high-volume spam feeds.

Currently, we just store everything in large mbox files in directories separated by day (think: /data/feed1/2015/09/13.mbox) on a single NFS server. We have ad-hoc scripts to extract features from these mboxes and pass them to our analysis pipelines (written in a mixture of R/matlab/python/etc). This system is reaching its limit point.

We already have a small Ceph installation with which we've had good luck for storing other data,and would like to see how we can use it to solve our mail problem. Our basic requirements are that:

- We need to be able to access each message by its extracted features. These features include simple information found in its header (for example From: and To:) as well as more complex information like signatures from attachments and network information (for example, presence in blacklists).
- We will frequently add/remove features.
- Faster access to recent data is more important than to older data.
- Maintaining strict ordering of incoming messages is not necessary. In other words, if we received two spam messages on our feeds, it doesn't matter too much if they are stored in that order, as long as we can have coarse-grained temporal accuracy (say, 5 minutes). So we don't need anything as sophisticated as Zlog.
- We need to be able to remove messages older than some specific age, due to storage constraints.

Any advice on how to use Ceph and librados to accomplish this? Here are my initial thoughts:

- Each message is an object with some unique ID. Use omap to store all its features in the same object.
- For each time period (which will have to be pre-specified to, say, an hour), we have an object which contains a list of ID's, as a bytestring of contatenated ID's. This should make expiring old messages trivial.
- For each feature, we have a timestamped index (like [email protected] or 20150813-has-attachment-with-hash-123abddeadbeef) the which contains a list of ID's.
- Hopefully use Rados classes to index/feature-extract on the OSD's.

Quoted 3 lines

How does this sound? One glaring omission is that I do not know how to create indices which would support querying by inequality/ranges ('find all messages between 1000 and 2000 bytes').

I would suggest some sort of hybrid approach, where you store your messages and your time index in ceph (so that you can insert data and expire data all within ceph), then use an external database for the queries your application layer is interested in. That way the external database becomes somewhat disposable (you can always rebuild efficiently for any given time period by consulting your time index in ceph), but you don't have to implement any multi-axis querying inside ceph.

With that kind of approach, you don't have to worry about implementing indices (let the existing database do it), but you do still have to worry about recovery from failure, i.e. keeping the ceph store and the database index up to date. You might need a "regenerate data for this time period" call that re-inserted all the last 5 minutes emails to the database after a failure of whatever is injecting the data.

John