<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>Hi , I’ve tried to do same thing, but new </span><a href="https://github.com/mongodb/mongo-c-driver" target="_blank">https://github.com/mongodb/mongo-c-driver</a>  <span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>is extremely buggy and still don’t have support for async cursor reading or keep alive connection (it keeps only handler structure for making new connection on the fly). <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>After a week of development and researches I got some working version but it’s didn’t work out on production, on existing database new mongo-c driver tried to make new kind of indexes which is not good for our database. <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>So at the end I’ve just created new concurrent service with Go and upstream for nginx …. And it works perfectly !!<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>I’ve tried to change Mongo C driver to work with Nginx upstream API, but I ended up with a lot of big changes, so I just gave up.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>I think using separate service for GridFS is more scalable than making it inside Nginx, because you can just make upstream to 100s of GrdiFS frontend services like I did.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>But anyway if you will do something like that I’ll defiantly contribute !!<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>Thanks <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><b><span style='font-size:11.0pt;font-family:"Calibri",sans-serif'>From:</span></b><span style='font-size:11.0pt;font-family:"Calibri",sans-serif'> nginx-devel [mailto:nginx-devel-bounces@nginx.org] <b>On Behalf Of </b>Alexander Rodin<br><b>Sent:</b> Monday, January 18, 2016 7:04 PM<br><b>To:</b> nginx-devel@nginx.org<br><b>Subject:</b> Architecture for asynchronous Mongo GridFS module for Nginx<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><div><div><div><div><div><div><p class=MsoNormal style='margin-bottom:12.0pt'>Hi all!<o:p></o:p></p></div><p class=MsoNormal style='margin-bottom:12.0pt'>I'm researching possible approaches to development of asynchronous GridFS module for Nginx (because the existing one blocks the main Nginx thread).<o:p></o:p></p></div><p class=MsoNormal style='margin-bottom:12.0pt'>I've read the source codes of most modules from <a href="https://www.nginx.com/resources/wiki/modules/" target="_blank">https://www.nginx.com/resources/wiki/modules/</a> and found that all of asynchronous modules (e.g. Postgres or Mongo) implement the database protocol by itself working with upstream. Is it the only way? I would like to use mongo-c-driver (<a href="https://github.com/mongodb/mongo-c-driver" target="_blank">https://github.com/mongodb/mongo-c-driver</a>) but I need an example how to embed it into Nginx event loop to make non-blocking module.<o:p></o:p></p></div><p class=MsoNormal style='margin-bottom:12.0pt'>Could you suggest any module that uses the same approach or some manual about it?<o:p></o:p></p></div><p class=MsoNormal>Best regards<o:p></o:p></p></div><div><p class=MsoNormal>Alexander<o:p></o:p></p></div></div></div></body></html>