understanding callback queue

42 views
Skip to first unread message

Buddha Shrestha

unread,
Jul 13, 2017, 12:11:49 AM7/13/17
to vert.x
Hi,

If I create a web application using Vert.x that connects to an API or a database to fetch some data, I could use its async http or jdbc client to get the results. 

Now, what I am curious about is that, if I choose a heavy task like reading a large number of records from a db using JDBC client and if I post multiple concurrent requests:

1. How are the callbacks triggered? Does any process poll each event and check if they're completed?
2. Where are all the requests stacked? Will it be in the callback queue?
3. Also, if I post large number of concurrent requests, where will the remaining handlers be stored if the number of requests is greater than my apps limit?

I just wanted to know more about the inner workings of the framework.

thanks,

Julien Viet

unread,
Jul 13, 2017, 3:11:54 AM7/13/17
to ve...@googlegroups.com
Hi,

the jdbc client uses executeBlocking with ordered = true to interact with the blocking JDBC driver, all requests are jdbc client command queued on the same worker thread (to guarantee order) task queue. The execution of a jdbc client command provides a result that is passed to the executeBlocking callback which schedules a callback on the event loop.

1. by the executeBlocking callback
2. in the same worker thread command queue
3. I don’t know what you call "app limit”, usually the limit is the latency of the database, the number of worker thread / connections to the database and the performance of the database

Julien

--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
Visit this group at https://groups.google.com/group/vertx.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/8157ef8c-b422-4472-b446-f365d2ea7cb4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Buddha Shrestha

unread,
Jul 13, 2017, 8:03:33 AM7/13/17
to vert.x
Thanks Julien,

About question 1. what about HTTP clients or apis like vertx.fileSystem().readFile? I tested these apis with heavy requests (each request took about 10 seconds to respond), and I found that average response time for concurrent requests was also about 10 seconds with some tolerance.

So, for these clients, is the mechanism same to check if the request completed? ( apart executeBlocking callback) 

Hope to hear from you.
Reply all
Reply to author
Forward
0 new messages