{"id":53530,"date":"2019-12-04T00:00:00","date_gmt":"2019-12-03T21:00:00","guid":{"rendered":"https:\/\/prohoster.info\/blog\/blog_prohoster\/uskoryaem-php-konnektory-dlya-tarantool-s-pomoshhyu-async-swoole-i-parallel"},"modified":"2020-02-18T14:01:26","modified_gmt":"2020-02-18T11:01:26","slug":"uskoryaem-php-konnektory-dlya-tarantool-s-pomoshhyu-async-swoole-i-parallel","status":"publish","type":"post","link":"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/uskoryaem-php-konnektory-dlya-tarantool-s-pomoshhyu-async-swoole-i-parallel","title":{"rendered":"Accelerating PHP connectors for Tarantool with Async, Swoole, and Parallel","gt_translate_keys":[{"key":"rendered","format":"text"}]},"content":{"rendered":"<p><img decoding=\"async\" alt=\"Accelerating PHP connectors for Tarantool with Async, Swoole, and Parallel\" src=\"\/wp-content\/uploads\/2019\/12\/a4bfc8a3f7f7de0298623b1bf9dcfc54.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<br \/>\nAktualisht, n\u00eb ekosistemin PHP ekzistojn\u00eb dy konektor\u00eb p\u00ebr pun\u00eb me serverin Tarantool \u2014 zgjerimi zyrtar PECL <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/tarantool\/tarantool-php\">tarantool\/tarantool-php<\/a><\/noindex>, i shkruar n\u00eb C, dhe <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/tarantool-php\/client\">tarantool-php\/client<\/a><\/noindex>, i shkruar n\u00eb PHP. Un\u00eb jam autori i k\u00ebtij t\u00eb fundit.<\/p>\n<p>N\u00eb k\u00ebt\u00eb artikull dua t\u00eb ndaj rezultatet e testimit t\u00eb performanc\u00ebs s\u00eb t\u00eb dyja bibliotekave dhe t\u00eb tregoj se si, me ndryshime minimale n\u00eb kod, mund t\u00eb arrihet nj\u00eb rritje e performanc\u00ebs prej 3\u20135 her\u00eb (<i>n\u00eb teste sintetike!<\/i>).<br \/>\n<noindex><a rel=\"nofollow\" name=\"habracut\"><\/a><\/noindex><\/p>\n<h2>\u00c7far\u00eb do t\u00eb testojm\u00eb?<\/h2>\n<p>\nDo t\u00eb testojm\u00eb konektor\u00ebt e p\u00ebrmendur m\u00eb sip\u00ebr, <i>sinkron\u00eb<\/i> , t\u00eb ekzekutuar n\u00eb m\u00ebnyr\u00eb asinkrone, paralelisht dhe n\u00eb m\u00ebnyr\u00eb asinkrone-paralele. \ud83d\ude42 Gjithashtu, nuk duam t\u00eb prekim kodin e vet\u00eb konektor\u00ebve. Aktualisht jan\u00eb t\u00eb disponueshme disa zgjerime q\u00eb lejojn\u00eb t\u00eb arrihet rezultati i d\u00ebshiruar:<\/p>\n<ul>\n<li><noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/swoole\/swoole-src\">Swoole<\/a><\/noindex> \u2014 nj\u00eb framework asinkron me performanc\u00eb t\u00eb lart\u00eb p\u00ebr PHP. P\u00ebrdoret nga gjigant\u00eb t\u00eb internetit si Alibaba dhe Baidu. Q\u00eb nga versioni 4.1.0 \u00ebsht\u00eb shfaqur metoda magjike <i>SwooleRuntime::enableCoroutine()<\/i>, e cila lejon q\u00eb \u201cme nj\u00eb rresht kodi, bibliotekat sinkrone t\u00eb rrjetit n\u00eb PHP t\u00eb shnd\u00ebrrohen n\u00eb asinkrone\u201d.\n<\/li>\n<li>Async \u2014 deri von\u00eb ishte nj\u00eb zgjerim mjaft premtues p\u00ebr pun\u00eb asinkrone n\u00eb PHP. Pse deri von\u00eb? Fatkeq\u00ebsisht, p\u00ebr nj\u00eb arsye q\u00eb nuk e di, autori e ka fshir\u00eb repository-n dhe e ardhmja e projektit mbetet e paqart\u00eb. Do t\u00eb duhet t\u00eb p\u00ebrdorim <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/dreamsxin\/ext-async\">nj\u00eb<\/a><\/noindex> nga forkat. Si Swoole, kjo zgjerim lejon n\u00eb nj\u00eb l\u00ebvizje t\u00eb leht\u00eb q\u00eb pantallonat t\u00eb aktivizojn\u00eb asinkronizimin duke z\u00ebvend\u00ebsuar implementimin standard t\u00eb TCP dhe TLS me versionet e tyre asinkrone. Kjo b\u00ebhet p\u00ebrmes opsionit &#171;<i>async.tcp = 1<\/i>&#171;.\n<\/li>\n<li><noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/krakjoe\/parallel\">Parallel<\/a><\/noindex> \u2014 nj\u00eb zgjerim mjaft i ri nga Joe Watkins, i njohur si autor i bibliotekave phpdbg, apcu, pthreads, pcov, uopz. Zgjerimi ofron nj\u00eb API p\u00ebr pun\u00eb shum\u00ebfij\u00ebshe n\u00eb PHP dhe pozicionohet si z\u00ebvend\u00ebsues i pthreads. Kufizimi i r\u00ebnd\u00ebsish\u00ebm i k\u00ebsaj biblioteke \u00ebsht\u00eb se funksionon vet\u00ebm me versionin ZTS (Zend Thread Safe) t\u00eb PHP.\n<\/li>\n<\/ul>\n<p><\/p>\n<h2>Si do ta testojm\u00eb?<\/h2>\n<p>\nLe t\u00eb lancojm\u00eb nj\u00eb instanc\u00eb t\u00eb Tarantool-it me regjistrimin e parashikimit t\u00eb ndaluar (<i>wal_mode = none<\/i>) dhe me buffer rrjeti t\u00eb rritur (<i>readahead = 1 * 1024 * 1024<\/i>). Opsioni i par\u00eb do t\u00eb p\u00ebrjashtoj\u00eb pun\u00ebn me diskun, nd\u00ebrsa i dyti do t\u00eb lejoj\u00eb leximin e m\u00eb shum\u00eb k\u00ebrkesave nga buffer-i i sistemit operativ dhe k\u00ebshtu do t\u00eb minimizoj\u00eb numrin e thirrjeve sistemore.<\/p>\n<p>P\u00ebr benchmark-et q\u00eb punojn\u00eb me t\u00eb dh\u00ebna (shtim, fshirje, lexim etj.), para nisjes s\u00eb benchmark-ut do t\u00eb krijohet ose rikrijohet nj\u00eb memtx-space, ku vlerat e indeksit primar gjenerohen nga gjeneratori i vlerave t\u00eb renditura t\u00eb numrave t\u00eb plot\u00eb (sequence).<br \/>\nDDL i space duket k\u00ebshtu:<\/p>\n<pre><code class=\"lua\">space = box.schema.space.create(config.space_name, {id = config.space_id, temporary = true})\nspace:create_index('primary', {type = 'tree', parts = {1, 'unsigned'}, sequence = true})\nspace:format({{name = 'id', type = 'unsigned'}, {name = 'name', type = 'string', is_nullable = false}})<\/code><\/pre>\n<p>\nSipas nevoj\u00ebs, para nisjes s\u00eb benchmark-ut, space mbushet me 10,000 tuple t\u00eb form\u00ebs<\/p>\n<pre><code class=\"lua\">{id, \"tupl\u0435_\"}<\/code><\/pre>\n<p>\nQasja te tuple kryhet sipas nj\u00eb vlere t\u00eb rast\u00ebsishme t\u00eb \u00e7el\u00ebsit.<\/p>\n<p>Vet\u00eb benchmark-u p\u00ebrfaq\u00ebson nj\u00eb k\u00ebrkes\u00eb t\u00eb vetme ndaj serverit, e cila ekzekutohet 10,000 her\u00eb (revolucione), q\u00eb nga ana e tyre kryhen n\u00eb iteracione. Iteracionet p\u00ebrs\u00ebriten derisa t\u00eb gjitha devijimet kohore midis 5 iteracioneve t\u00eb jen\u00eb brenda kufirit t\u00eb lejuar t\u00eb gabimit prej 3 %*. Pas k\u00ebsaj merret rezultati mesatar. Midis iteracioneve ka nj\u00eb pauz\u00eb prej 1 sekonde, q\u00eb procesori t\u00eb mos kaloj\u00eb n\u00eb throttling. Garbage collector i Lua \u00e7aktivizohet para \u00e7do iteracioni dhe niset me forc\u00eb pas p\u00ebrfundimit t\u00eb tij. Procesi PHP niset vet\u00ebm me zgjerimet e nevojshme p\u00ebr benchmark-un, me output buffering t\u00eb aktivizuar dhe garbage collector t\u00eb \u00e7aktivizuar.<\/p>\n<p><i>* Numri i revolucioneve, iteracioneve dhe pragu i gabimit mund t\u00eb ndryshohen n\u00eb cil\u00ebsimet e benchmark-ut.<\/i><\/p>\n<h2>Mjedisi i testimit<\/h2>\n<p>\nT\u00eb dh\u00ebnat e publikuara m\u00eb posht\u00eb u b\u00ebn\u00eb n\u00eb MacBookPro (2015), sistemi operativ \u2014 Fedora 30 (versioni i b\u00ebrthamor 5.3.8-200.fc30.x86_64). Tarantool u lancua n\u00eb Docker me parametrin &#171;<code>--network host\"<\/code>.<\/p>\n<p>Versionet e paketave:<\/p>\n<p>Tarantool: 2.3.0-115-g5ba5ed37e<br \/>\nDocker: 19.03.3, build a872fc2f86<br \/>\nPHP: 7.3.11 (cli) (built: Oct 22 2019 08:11:04)<br \/>\ntarantool\/client: 0.6.0<br \/>\nrybakit\/msgpack: 0.6.1<br \/>\next-tarantool: 0.3.2 (+ patch p\u00ebr 7.3)*<br \/>\next-msgpack: 2.0.3<br \/>\next-async: 0.3.0-8c1da46<br \/>\next-swoole: 4.4.12<br \/>\next-parallel: 1.1.3<\/p>\n<p>* <i>Fatkeq\u00ebsisht, konektori zyrtar nuk punon me versionin PHP &gt; 7.2. P\u00ebr t\u00eb kompiluar dhe nisur zgjerimin n\u00eb PHP 7.3, u desh t\u00eb p\u00ebrdorej <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/tarantool\/tarantool-php\/pull\/148\/files\">patch-i<\/a><\/noindex>.<\/i><\/p>\n<h2>Rezultatet<\/h2>\n<p><\/p>\n<h4>Modaliteti sinkron<\/h4>\n<p>\nProtokolli i Tarantool p\u00ebrdor formatin binar <noindex><a rel=\"nofollow\" href=\"https:\/\/msgpack.org\/\">MessagePack<\/a><\/noindex> p\u00ebr serializimin e mesazheve. N\u00eb konektorin PECL, serializimi \u00ebsht\u00eb i fshehur thell\u00eb n\u00eb brend\u00ebsi t\u00eb bibliotek\u00ebs dhe t\u00eb ndikosh n\u00eb procesin e kodimit nga kodi userland <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/tarantool\/tarantool-php\/issues\/89\">nuk \u00ebsht\u00eb e mundur<\/a><\/noindex>. Ndryshe, konektori n\u00eb PHP t\u00eb past\u00ebr ofron mund\u00ebsin\u00eb e personalizimit t\u00eb procesit t\u00eb enkodimit duke zgjeruar enkoderin standard ose duke p\u00ebrdorur implementimin tuaj. Si parazgjedhje jan\u00eb t\u00eb disponuesh\u00ebm dy enkoder\u00eb: nj\u00ebri bazohet n\u00eb <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/msgpack\/msgpack-php\/\">msgpack\/msgpack-php<\/a><\/noindex> (zgjerimi zyrtar MessagePack PECL), nd\u00ebrsa tjetri n\u00eb <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/rybakit\/msgpack.php\">rybakit\/msgpack<\/a><\/noindex> (n\u00eb PHP t\u00eb past\u00ebr).<\/p>\n<p>Para se t\u00eb krahasojm\u00eb konektor\u00ebt, le t\u00eb masim performanc\u00ebn e enkoder\u00ebve MessagePack p\u00ebr konektorin PHP dhe n\u00eb testet e m\u00ebtejshme do t\u00eb p\u00ebrdorim at\u00eb q\u00eb jep rezultatin m\u00eb t\u00eb mir\u00eb:<\/p>\n<p><img decoding=\"async\" alt=\"Accelerating PHP connectors for Tarantool with Async, Swoole, and Parallel\" src=\"\/wp-content\/uploads\/2019\/12\/a293ec51cb8bf18cb88df2dc276142c4.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\nEdhe pse versioni PHP (Pure) \u00ebsht\u00eb m\u00eb i ngadalt\u00eb se zgjerimi PECL, n\u00eb projekte reale un\u00eb p\u00ebrs\u00ebri do t\u00eb rekomandoja p\u00ebrdorimin e <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/rybakit\/msgpack.php\">rybakit\/msgpack<\/a><\/noindex>, sepse n\u00eb zgjerimin zyrtar MessagePack specifikimi i formatit \u00ebsht\u00eb implementuar vet\u00ebm pjes\u00ebrisht (p\u00ebr shembull, nuk ka mb\u00ebshtetje p\u00ebr tipe t\u00eb personalizuara t\u00eb t\u00eb dh\u00ebnave, pa t\u00eb cilat nuk do t\u00eb mund t\u00eb p\u00ebrdorni Decimal \u2014 tipi i ri i t\u00eb dh\u00ebnave i prezantuar n\u00eb Tarantool 2.3) dhe ka nj\u00eb s\u00ebr\u00eb problemesh t\u00eb tjera <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/msgpack\/msgpack-php\/issues\">problemi<\/a><\/noindex> (p\u00ebrfshir\u00eb problemet e pajtueshm\u00ebris\u00eb me PHP 7.4). Dhe n\u00eb p\u00ebrgjith\u00ebsi, projekti duket i braktisur.<\/p>\n<p>Tani le t\u00eb masim performanc\u00ebn e konektor\u00ebve n\u00eb modalitetin sinkron:<\/p>\n<p><img decoding=\"async\" alt=\"Accelerating PHP connectors for Tarantool with Async, Swoole, and Parallel\" src=\"\/wp-content\/uploads\/2019\/12\/d8c5765956c62b927014ec4f26547820.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\nSi\u00e7 shihet nga grafiku, konektori PECL (Tarantool) tregon performanc\u00eb m\u00eb t\u00eb mir\u00eb krahasuar me konektorin n\u00eb PHP (Client). Por kjo nuk \u00ebsht\u00eb p\u00ebr t\u2019u habitur, duke pasur parasysh se i dyti, p\u00ebrve\u00e7se \u00ebsht\u00eb implementuar n\u00eb nj\u00eb gjuh\u00eb m\u00eb t\u00eb ngadalt\u00eb, n\u00eb thelb kryen m\u00eb shum\u00eb pun\u00eb: n\u00eb \u00e7do thirrje krijohet nj\u00eb objekt i ri <i>Request<\/i> dhe <i>P\u00ebrgjigjja<\/i> (n\u00eb rastin e Select \u2014 edhe <i>Criteria<\/i>, nd\u00ebrsa n\u00eb rastin e Update\/Upsert \u2014 <i>Operations<\/i>), entitetet e ve\u00e7anta <i>Connection<\/i>, <i>Packer <\/i>dhe <i>Handler<\/i> gjithashtu shtojn\u00eb overhead. \u00cbsht\u00eb e qart\u00eb se fleksibiliteti ka koston e vet. Megjithat\u00eb, n\u00eb p\u00ebrgjith\u00ebsi, interpreteri PHP tregon performanc\u00eb t\u00eb mir\u00eb; edhe pse ka diferenc\u00eb, ajo \u00ebsht\u00eb e vog\u00ebl dhe ndoshta do t\u00eb jet\u00eb edhe m\u00eb e vog\u00ebl me p\u00ebrdorimin e preloading n\u00eb PHP 7.4, pa p\u00ebrmendur JIT n\u00eb PHP 8.<\/p>\n<p>Le t\u00eb vazhdojm\u00eb. N\u00eb Tarantool 2.0 u shtua mb\u00ebshtetja p\u00ebr SQL. Le t\u00eb provojm\u00eb t\u00eb kryejm\u00eb operacionet Select, Insert, Update dhe Delete duke p\u00ebrdorur protokollin SQL dhe t\u2019i krahasojm\u00eb rezultatet me ekuivalent\u00ebt noSQL (binar\u00eb):<\/p>\n<p><img decoding=\"async\" alt=\"Accelerating PHP connectors for Tarantool with Async, Swoole, and Parallel\" src=\"\/wp-content\/uploads\/2019\/12\/cbc61697d9670dc7384c25de3c63c8d5.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\nRezultatet e SQL nuk jan\u00eb ve\u00e7an\u00ebrisht mbres\u00ebl\u00ebn\u00ebse (ju kujtoj se ende po testojm\u00eb modalitetin sinkron). Megjithat\u00eb, nuk do t\u00eb nxitoja t\u00eb zhg\u00ebnjehesha p\u00ebr k\u00ebt\u00eb, sepse mb\u00ebshtetja p\u00ebr SQL \u00ebsht\u00eb ende n\u00eb zhvillim aktiv (p\u00ebr shembull, jo shum\u00eb koh\u00eb m\u00eb par\u00eb u shtua mb\u00ebshtetja p\u00ebr <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/tarantool\/tarantool\/commit\/ff2091e09b5a7e9b7aa3f3e996dc7a06189889f3\">prepared statements<\/a><\/noindex>) dhe, duke gjykuar nga lista e <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/tarantool\/tarantool\/issues?q=is%3Aissue+is%3Aopen+sql+label%3Aperformance\">issues<\/a><\/noindex>, motori SQL m\u00eb tej pret nj\u00eb s\u00ebr\u00eb optimizimesh.<\/p>\n<h4>Async<\/h4>\n<p>\nTani t\u00eb shohim se si zgjerimi Async mund t\u00eb na ndihmoj\u00eb t\u00eb p\u00ebrmir\u00ebsojm\u00eb rezultatet e m\u00ebsip\u00ebrme. P\u00ebr t\u00eb shkruar programe asinkrone, zgjerimi ofron nj\u00eb API t\u00eb bazuar n\u00eb korutina (coroutines), dhe pik\u00ebrisht at\u00eb do t\u00eb p\u00ebrdorim. Nga testimet rezulton se numri optimal i korutinave p\u00ebr mjedisin ton\u00eb \u00ebsht\u00eb 25:<\/p>\n<p><img decoding=\"async\" alt=\"Accelerating PHP connectors for Tarantool with Async, Swoole, and Parallel\" src=\"\/wp-content\/uploads\/2019\/12\/4ceefef522b3bd91db7327c609ddda09.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\nI \u201cshp\u00ebrndajm\u00eb\u201d 10,000 operacione n\u00eb 25 korutina dhe shohim \u00e7far\u00eb rezultati mor\u00ebm:<\/p>\n<p><img decoding=\"async\" alt=\"Accelerating PHP connectors for Tarantool with Async, Swoole, and Parallel\" src=\"\/wp-content\/uploads\/2019\/12\/916e461dfa5d1be08317e3703c267afe.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\nNumri i operacioneve p\u00ebr sekond\u00eb u rrit m\u00eb shum\u00eb se 3 her\u00eb p\u00ebr <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/tarantool-php\/client\">tarantool-php\/client<\/a><\/noindex>!<\/p>\n<p>P\u00ebr fat t\u00eb keq, konektori PECL nuk u nis me ext-async.<\/p>\n<p>Po me SQL \u00e7far\u00eb ndodh?<\/p>\n<p><img decoding=\"async\" alt=\"Accelerating PHP connectors for Tarantool with Async, Swoole, and Parallel\" src=\"\/wp-content\/uploads\/2019\/12\/39a0da214b893a217d9ae4eae23c4168.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\nSi\u00e7 mund ta shihni, n\u00eb modalitetin asinkron diferenca midis protokollit binar dhe SQL ra brenda kufijve t\u00eb devijimit statistikor.<\/p>\n<h4>Swoole<\/h4>\n<p>\nP\u00ebrs\u00ebri po p\u00ebrcaktojm\u00eb numrin optimal t\u00eb korutinave, k\u00ebt\u00eb her\u00eb p\u00ebr Swoole:<br \/>\n<img decoding=\"async\" alt=\"Accelerating PHP connectors for Tarantool with Async, Swoole, and Parallel\" src=\"\/wp-content\/uploads\/2019\/12\/70d5bb26b91b7459e2f0b80a3fab7e06.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\nDo t\u00eb ndalemi te 25. Le t\u00eb p\u00ebrs\u00ebrisim t\u00eb nj\u00ebjtin truk si me zgjerimin Async \u2014 do t\u00eb shp\u00ebrndajm\u00eb 10,000 operacione mes 25 korutinave. P\u00ebrve\u00e7 k\u00ebsaj, do t\u00eb shtojm\u00eb edhe nj\u00eb test ku t\u00eb gjith\u00eb ngarkes\u00ebn do ta ndajm\u00eb n\u00eb 2 procese (pra secili proces do t\u00eb kryej\u00eb 5,000 operacione n\u00eb 25 korutina). Proceset do t\u00eb krijohen me ndihm\u00ebn e <i>SwooleProcess<\/i>. <\/p>\n<p>Rezultatet:<\/p>\n<p><img decoding=\"async\" alt=\"Accelerating PHP connectors for Tarantool with Async, Swoole, and Parallel\" src=\"\/wp-content\/uploads\/2019\/12\/55f55d2661aa43ca3b6641abfff078a6.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\nSwoole tregon nj\u00eb rezultat pak m\u00eb t\u00eb ul\u00ebt krahasuar me Async kur ekzekutohet n\u00eb nj\u00eb proces, por me 2 procese pamja ndryshon rr\u00ebnj\u00ebsisht (numri 2 nuk \u00ebsht\u00eb zgjedhur rast\u00ebsisht: n\u00eb kompjuterin tim pik\u00ebrisht 2 procese dhan\u00eb rezultatin m\u00eb t\u00eb mir\u00eb).<\/p>\n<p><i>Meq\u00eb ra fjala, zgjerimi Async ka gjithashtu API p\u00ebr pun\u00eb me procese, por aty nuk vura re ndonj\u00eb ndryshim nga ekzekutimi i benchmark-eve n\u00eb nj\u00eb apo disa procese (nuk p\u00ebrjashtohet q\u00eb mund t\u00eb kem b\u00ebr\u00eb ndonj\u00eb gabim diku).<\/i><\/p>\n<p>SQL kundrejt protokollit binar:<\/p>\n<p><img decoding=\"async\" alt=\"Accelerating PHP connectors for Tarantool with Async, Swoole, and Parallel\" src=\"\/wp-content\/uploads\/2019\/12\/dfa56be01ebba25edbec492838112778.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\nAshtu si me Async, diferenca midis operacioneve binare dhe atyre SQL zbutet n\u00eb modalitetin asinkron.<\/p>\n<h4>Parallel<\/h4>\n<p>\nMeqen\u00ebse zgjerimi Parallel nuk ka t\u00eb b\u00ebj\u00eb me korutina, por me fije ekzekutimi, le t\u00eb masim numrin optimal t\u00eb fijeve paralele:<\/p>\n<p><img decoding=\"async\" alt=\"Accelerating PHP connectors for Tarantool with Async, Swoole, and Parallel\" src=\"\/wp-content\/uploads\/2019\/12\/acc6796d5731b0402ad6323e0f5bf38f.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\nN\u00eb kompjuterin tim ai \u00ebsht\u00eb 16. Le t\u00eb nisim benchmark-et e konektor\u00ebve n\u00eb 16 fije paralele:<\/p>\n<p><img decoding=\"async\" alt=\"Accelerating PHP connectors for Tarantool with Async, Swoole, and Parallel\" src=\"\/wp-content\/uploads\/2019\/12\/03210b70f15e445fdd311a17c1034290.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\nSi\u00e7 mund ta shihni, rezultati \u00ebsht\u00eb madje m\u00eb i mir\u00eb se me zgjerimet asinkrone (me p\u00ebrjashtim t\u00eb Swoole t\u00eb nisur n\u00eb 2 procese). Vini re se p\u00ebr konektorin PECL, te operacionet Update dhe Upsert nuk ka t\u00eb dh\u00ebna. Kjo lidhet me faktin se k\u00ebto operacione d\u00ebshtuan me gabim \u2014 nuk e di n\u00ebse faji \u00ebsht\u00eb i ext-parallel, ext-tarantool apo i t\u00eb dyjave.<\/p>\n<p>Tani le t\u00eb krahasojm\u00eb performanc\u00ebn e SQL:<\/p>\n<p><img decoding=\"async\" alt=\"Accelerating PHP connectors for Tarantool with Async, Swoole, and Parallel\" src=\"\/wp-content\/uploads\/2019\/12\/4be3025b424ad6485dc96968ce224bf5.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\nE vut\u00eb re ngjashm\u00ebrin\u00eb me grafikun p\u00ebr konektor\u00ebt e nisur n\u00eb m\u00ebnyr\u00eb sinkrone?<\/p>\n<h4>Gjith\u00e7ka s\u00eb bashku<\/h4>\n<p>\nDhe n\u00eb fund, le t\u2019i p\u00ebrmbledhim t\u00eb gjitha rezultatet n\u00eb nj\u00eb grafik t\u00eb vet\u00ebm, q\u00eb t\u00eb shohim pamjen e p\u00ebrgjithshme t\u00eb zgjerimeve t\u00eb testuara. N\u00eb grafik do t\u00eb shtojm\u00eb vet\u00ebm nj\u00eb test t\u00eb ri, t\u00eb cilin ende nuk e kemi b\u00ebr\u00eb \u2015 do t\u2019i nisim coroutine-t Async paralelisht me ndihm\u00ebn e Parallel*. Ideja e integrimit t\u00eb zgjerimeve t\u00eb p\u00ebrmendura m\u00eb sip\u00ebr \u00ebsht\u00eb <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/krakjoe\/parallel\/issues\/25\">diskutuar<\/a><\/noindex> nga autor\u00ebt, por ende nuk \u00ebsht\u00eb arritur konsensus, ndaj do t\u00eb na duhet ta b\u00ebjm\u00eb vet\u00eb. <\/p>\n<p><i>* Nuk u arrit t\u00eb niseshin coroutine-t Swoole me Parallel; duket se k\u00ebto zgjerime nuk jan\u00eb t\u00eb pajtueshme.<\/i><\/p>\n<p>Pra, rezultatet p\u00ebrfundimtare:<\/p>\n<p><img decoding=\"async\" alt=\"Accelerating PHP connectors for Tarantool with Async, Swoole, and Parallel\" src=\"\/wp-content\/uploads\/2019\/12\/85478d9dd5d8bd166f4aa91963c1af95.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<h2>N\u00eb p\u00ebrfundim<\/h2>\n<p>\nSipas mendimit tim, rezultatet dol\u00ebn mjaft t\u00eb mira, dhe p\u00ebr ndonj\u00eb arsye jam i bindur se kjo nuk \u00ebsht\u00eb ende kufiri! N\u00ebse kjo ju nevojitet n\u00eb nj\u00eb projekt real, k\u00ebt\u00eb mund ta vendosni vet\u00ebm ju vet\u00eb; un\u00eb mund t\u00eb them vet\u00ebm se p\u00ebr mua ishte nj\u00eb eksperiment interesant, q\u00eb b\u00ebri t\u00eb mundur vler\u00ebsimin se sa mund t\u00eb \u201cnxirret\u201d nga nj\u00eb konektor TCP sinkron me p\u00ebrpjekje minimale. N\u00ebse keni ide p\u00ebr p\u00ebrmir\u00ebsimin e benchmark-ve, do ta shqyrtoj me k\u00ebnaq\u00ebsi pull request-in tuaj. I gjith\u00eb kodi me udh\u00ebzimet e nisjes dhe rezultatet \u00ebsht\u00eb publikuar n\u00eb nj\u00eb <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/tarantool-php\/benchmarks\">repotit\u00eb e tij<\/a><\/noindex>.<br \/>\n<br \/>Burimi: <a content=\"nofollow\" rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/company\/mailru\/blog\/478336\/\">habr.com<\/a><\/p>","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"excerpt":{"rendered":"<p>\u0412 \u044d\u043a\u043e\u0441\u0438\u0441\u0442\u0435\u043c\u0435 PHP \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0434\u0432\u0430 \u043a\u043e\u043d\u043d\u0435\u043a\u0442\u043e\u0440\u0430 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c Tarantool \u2015 \u044d\u0442\u043e \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 PECL tarantool\/tarantool-php, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0435 \u043d\u0430 \u0421, \u0438 tarantool-php\/client, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 PHP. \u042f \u044f\u0432\u043b\u044f\u044e\u0441\u044c \u0430\u0432\u0442\u043e\u0440\u043e\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c\u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043e\u0431\u0435\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c, \u043a\u0430\u043a \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0432 \u043a\u043e\u0434\u0435 \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f [&hellip;]<\/p>\n","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[688],"tags":[],"class_list":["post-53530","post","type-post","status-publish","format-standard","hentry","category-administrirovanie"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.2 - aioseo.com -->\n\t<meta name=\"description\" content=\"\u0412 \u044d\u043a\u043e\u0441\u0438\u0441\u0442\u0435\u043c\u0435 PHP.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Yuri Gagarin\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/uskoryaem-php-konnektory-dlya-tarantool-s-pomoshhyu-async-swoole-i-parallel\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.2\" \/>\n\t\t<meta property=\"og:locale\" content=\"sq_AL\" \/>\n\t\t<meta property=\"og:site_name\" content=\"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"\ud83e\udd47\u0423\u0441\u043a\u043e\u0440\u044f\u0435\u043c PHP-\u043a\u043e\u043d\u043d\u0435\u043a\u0442\u043e\u0440\u044b \u0434\u043b\u044f Tarantool \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Async, Swoole \u0438 Parallel | ProHoster\" \/>\n\t\t<meta property=\"og:description\" content=\"\u0412 \u044d\u043a\u043e\u0441\u0438\u0441\u0442\u0435\u043c\u0435 PHP.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/uskoryaem-php-konnektory-dlya-tarantool-s-pomoshhyu-async-swoole-i-parallel\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:width\" content=\"350\" \/>\n\t\t<meta property=\"og:image:height\" content=\"350\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2019-12-03T21:00:00+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2020-02-18T11:01:26+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"\ud83e\udd47P\u00ebrshpejtojm\u00eb konektor\u00ebt PHP p\u00ebr Tarantool me Async, Swoole dhe Parallel | ProHoster","description":"N\u00eb ekosistemin PHP.","canonical_url":"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/uskoryaem-php-konnektory-dlya-tarantool-s-pomoshhyu-async-swoole-i-parallel","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"sq_AL","og:site_name":"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b","og:type":"article","og:title":"\ud83e\udd47\u0423\u0441\u043a\u043e\u0440\u044f\u0435\u043c PHP-\u043a\u043e\u043d\u043d\u0435\u043a\u0442\u043e\u0440\u044b \u0434\u043b\u044f Tarantool \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Async, Swoole \u0438 Parallel | ProHoster","og:description":"\u0412 \u044d\u043a\u043e\u0441\u0438\u0441\u0442\u0435\u043c\u0435 PHP.","og:url":"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/uskoryaem-php-konnektory-dlya-tarantool-s-pomoshhyu-async-swoole-i-parallel","og:image":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:secure_url":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:width":350,"og:image:height":350,"article:published_time":"2019-12-03T21:00:00+00:00","article:modified_time":"2020-02-18T11:01:26+00:00","article:publisher":"https:\/\/www.facebook.com\/prohoster","article:author":"https:\/\/www.facebook.com\/prohoster"},"aioseo_meta_data":{"post_id":"53530","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"seo_analyzer_scan_date":"2026-01-24 07:46:24","breadcrumb_settings":null,"limit_modified_date":false,"reviewed_by":null,"ai":null,"created":"2021-02-28 20:23:55","updated":"2026-01-24 07:46:24","focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"gt_translate_keys":[{"key":"link","format":"url"}],"_links":{"self":[{"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/posts\/53530","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/comments?post=53530"}],"version-history":[{"count":0,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/posts\/53530\/revisions"}],"wp:attachment":[{"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/media?parent=53530"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/categories?post=53530"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/tags?post=53530"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}