Skip to contentSkip to conversation

Question about IoCtx::aio_exec semantics

DISCUSSION Noah Watkins 2 participants 3 messages Apr 19, 2012

lore
Share & tools
lore
#0 lore raw

I've had a lot of success using rados_exec(), but I need to graduate the implementation to use IoCtx::aio_exec for increased concurrency. I'm a little confused about how aio_exec should be used:

Here is aio_exec:

   int aio_exec(const std::string& oid, AioCompletion *c, const char *cls, const char *method, bufferlist& inbl, bufferlist *outbl);

I'd like to have many outstanding competitions, one for each call of aio_exec. Once @c has completed, I'd like to have access to the @outbl bufferlist. So, is the intended use here to allocate an empty bufferlist for each submitted completion?

In rgw/rgw_rados.cc a use is:

  AioCompletion *c = librados::Rados::aio_create_completion(NULL, NULL, NULL);                                                                                                                                                                                        
  r = io_ctx.aio_exec(oid, c, "rgw", "dir_suggest_changes", in, NULL);                                                                                                                                                                                                
  c->release();

To clarify, are the semantics here that an asynchronous aio_exec is made without checking for completion or return values.

Thanks,
Noah

#1 lore raw
Quoted 7 lines · Noah Watkins

I've had a lot of success using rados_exec(), but I need to graduate the implementation to use IoCtx::aio_exec for increased concurrency. I'm a little confused about how aio_exec should be used:

Here is aio_exec:

  int aio_exec(const std::string& oid, AioCompletion *c, const char *cls, const char *method, bufferlist& inbl, bufferlist *outbl);

I'd like to have many outstanding competitions, one for each call of aio_exec. Once @c has completed, I'd like to have access to the @outbl bufferlist. So, is the intended use here to allocate an empty bufferlist for each submitted completion?

Yes, you'll need to have a bufferlist for each request sent if your exec is expected to return data. Note that only read operations should return data.

Quoted 8 lines

In rgw/rgw_rados.cc a use is:

 AioCompletion *c = librados::Rados::aio_create_completion(NULL, NULL, NULL); r = io_ctx.aio_exec(oid, c, "rgw", "dir_suggest_changes", in, NULL); c->release();

To clarify, are the semantics here that an asynchronous aio_exec is made without checking for completion or return values.

Right. We send the "dir_suggest_changes" request and dropping the reference, so that we can't get the return value once it's done.

Yehuda
--
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

#2 lore raw

Fantastic. Thanks!

-Noah

Quoted 25 lines · Yehuda Sadeh Weinraub
Quoted 7 lines · Noah Watkins

I've had a lot of success using rados_exec(), but I need to graduate the implementation to use IoCtx::aio_exec for increased concurrency. I'm a little confused about how aio_exec should be used:

Here is aio_exec:

  int aio_exec(const std::string& oid, AioCompletion *c, const char *cls, const char *method, bufferlist& inbl, bufferlist *outbl);

I'd like to have many outstanding competitions, one for each call of aio_exec. Once @c has completed, I'd like to have access to the @outbl bufferlist. So, is the intended use here to allocate an empty bufferlist for each submitted completion?

Yes, you'll need to have a bufferlist for each request sent if your exec is expected to return data. Note that only read operations should return data.

Quoted 8 lines

In rgw/rgw_rados.cc a use is:

AioCompletion *c = librados::Rados::aio_create_completion(NULL, NULL, NULL); r = io_ctx.aio_exec(oid, c, "rgw", "dir_suggest_changes", in, NULL); c->release();

To clarify, are the semantics here that an asynchronous aio_exec is made without checking for completion or return values.

Right. We send the "dir_suggest_changes" request and dropping the reference, so that we can't get the return value once it's done.

Yehuda