… | |
… | |
20 | This can be used to make parallel sql requests using Coro, or to do other |
20 | This can be used to make parallel sql requests using Coro, or to do other |
21 | stuff while mysql is rumbling in the background. |
21 | stuff while mysql is rumbling in the background. |
22 | |
22 | |
23 | =head2 CAVEAT |
23 | =head2 CAVEAT |
24 | |
24 | |
25 | Note that this module must be linked against exactly the same |
25 | Note that this module must be linked against exactly the same (shared, |
26 | F<libmysqlclient> library as DBD::mysql, otherwise it will not work. |
26 | possibly not working with all OSes) F<libmysqlclient> library as |
|
|
27 | DBD::mysql, otherwise it will not work. |
27 | |
28 | |
28 | Also, while this module makes database handles non-blocking, you still |
29 | Also, while this module makes database handles non-blocking, you still |
29 | cannot run multiple requests in parallel on the same database handle. If |
30 | cannot run multiple requests in parallel on the same database handle. If |
30 | you want to run multiple queries in parallel, you have to create multiple |
31 | you want to run multiple queries in parallel, you have to create multiple |
31 | database connections, one for each thread that runs queries. Not doing so |
32 | database connections, one for each thread that runs queries. Not doing so |
… | |
… | |
50 | |
51 | |
51 | For very fast queries ("select 0"), this module can add noticable overhead |
52 | For very fast queries ("select 0"), this module can add noticable overhead |
52 | (around 15%) as it tries to switch to other coroutines when mysqld doesn't |
53 | (around 15%) as it tries to switch to other coroutines when mysqld doesn't |
53 | deliver the data instantly. |
54 | deliver the data instantly. |
54 | |
55 | |
55 | For most types of queries, there will be no overhead, especially on |
56 | For most types of queries, there will be no extra latency, especially on |
56 | multicore systems where your perl process can do other things while mysqld |
57 | multicore systems where your perl process can do other things while mysqld |
57 | does its stuff. |
58 | does its stuff. |
58 | |
59 | |
59 | =head2 LIMITATIONS |
60 | =head2 LIMITATIONS |
60 | |
61 | |
… | |
… | |
87 | |
88 | |
88 | sub readable { &Coro::Handle::FH::readable } |
89 | sub readable { &Coro::Handle::FH::readable } |
89 | sub writable { &Coro::Handle::FH::writable } |
90 | sub writable { &Coro::Handle::FH::writable } |
90 | |
91 | |
91 | BEGIN { |
92 | BEGIN { |
92 | our $VERSION = '1.0'; |
93 | our $VERSION = '1.02'; |
93 | |
94 | |
94 | require XSLoader; |
95 | require XSLoader; |
95 | XSLoader::load Coro::Mysql::, $VERSION; |
96 | XSLoader::load Coro::Mysql::, $VERSION; |
96 | } |
97 | } |
97 | |
98 | |