mruby_nginx_module icon indicating copy to clipboard operation
mruby_nginx_module copied to clipboard

Deference between ngx_mruby

Open mibamur opened this issue 11 years ago • 5 comments

Hello @cubicdaiya! It`s really hard to understand deference between ngx_mruby and yours. Please help me understand!

  1. You want to develop nginx addons from ruby/mruby? So we have some nginx source C code and must to write nginx`s module as
    struct ngx_command_t {
        ngx_str_t             name;
        ngx_uint_t            type;
        char               *(*set)(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
        ngx_uint_t            conf;
        ngx_uint_t            offset;
        void                 *post;
    };

and so on... classic nginx module structure As I understand, we/you must generate C source module from template by ruby/mruby. We just create some wizard that help to answer questions? For example choose what directive configuration we want use NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF

static ngx_command_t  ngx_http_gzip_static_commands[] = {

    { ngx_string("gzip_static"),
    NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
      ngx_conf_set_enum_slot,
      NGX_HTTP_LOC_CONF_OFFSET,
      offsetof(ngx_http_gzip_static_conf_t, enable),
      &ngx_http_gzip_static },

      ngx_null_command
};

Am I right? Or you want integrate full nginx API support from mruby and then we may make manipulations nginx`s behaviour without recompiling? If that? - It sounds fine!

Thx.

mibamur avatar Oct 24 '13 10:10 mibamur

I see ngxmodgen. I`m going to add some fetures to it. Great! So, what about add all fetures for nginx module generation like in http://www.evanmiller.org/nginx-modules-guide.html

mibamur avatar Oct 24 '13 10:10 mibamur

It`s really hard to understand deference between ngx_mruby and yours. Please help me understand!

The goal of the author of ngx_mruby is the unification of how to describe configuration and extension of web servers(Apache, nginx, Varnish, Apache Traffic Server, etc). This is one of his subject of research.

But what I want to develop is the nginx-specified product.

For example, Built-in Regexp, nginx-internal api bindings and so on. And I think it needs features for treating co-routine and non-blocking socket and sub-request though they are not implemented yet.

As it's soon after mruby_nginx_module is forked( at July 2013), There is not definitive difference between ngx_mruby very well at this time yet. Additionally, It is also the reason that ngx_mruby is reflected my design concept at this time. Because more than half of the features of ngx_mruby are implemented by me. But it would not for the feature.

Please see the following url about difference between ngx_mruby at this time.

https://github.com/cubicdaiya/mruby_nginx_module#difference-between-ngx_mruby

And if you know in more detail, pelase see the following page. mruby_nginx_module is full-documented except Built-in Regexp.

http://cubicdaiya.github.io/mruby_nginx_module/

In a simple term, what I want to develop is rather like the mruby version of lua-nginx-module.

But the goal of ngx_mruby is different from it. So I decided to fork after having a talk with him.

Or you want integrate full nginx API support from mruby and then we may make manipulations nginx`s behaviour without recompiling? If that?

Nearly yes.

I see ngxmodgen. I`m going to add some fetures to it. Great!

Thanks. I'm looking forward to see it.

cubicdaiya avatar Oct 24 '13 23:10 cubicdaiya

Good job @cubicdaiya !

charlescui avatar Oct 25 '13 02:10 charlescui

@cubicdaiya thanks! You opened my eyes. "^_^".open # => O_O

Year, Sysoev Igor saw about PCRE: "I know how it works, but I did not used it! And you will better to do so! Better use static directive without any Regex"

Now I have a plan
  1. First, not nil. - Make small changes for mruby_nginx_module documentation: install script-text, add more example with nginx.conf_templates

  2. Analyze lua and perl binding work with nginx "API"

  • nginx have specific "hard", but very productive plan work with buffers poll, often they didt work with RAM (memcopy), just pass buffers handler address from module to module and async - its harder that write Apache modules.
  1. List available features from lua, perl - make one tables = who.where.how

  2. get all free-popular nginx modules + add it`s features to table + add what I or other want to see

  3. make visual scheme - for better understanding

  • try to understand how pass arguments and varible from module to module, when IN and when OUT
  1. update from trunk nginx_dev_module for last nginx sources (1.4, 1.5)
  • update nginx_module_generator template, comment weach place, make wizzard for generate new module, add example techniks
  1. benchmark all, test each other: lua, mruby, perl, native - redis, memcache, pg, drizzle

  2. nginx patches from Openresty for Linux (Sysoev married FreeBSD)

  3. port or try port to other platform ARM, MIPS

And @cubicdaiya excuse me, if Ill often make issue or PR in feature - Im only learning

mibamur avatar Oct 25 '13 19:10 mibamur

@charlescui

Thanks. Encouraging.

@mibamur

And @cubicdaiya excuse me, if Ill often make issue or PR in feature - Im only learning

Thanks. Both are always welcome.

As my comment in this issue includes the how and why of fork, I save this issue.

cubicdaiya avatar Oct 26 '13 07:10 cubicdaiya