cubicdaiya / mruby_nginx_module

Embed mruby into nginx
http://cubicdaiya.github.io/mruby_nginx_module
Other
34 stars 5 forks source link

Deference between ngx_mruby #1

Open mibamur opened 10 years ago

mibamur commented 10 years ago

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 commented 10 years ago

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

cubicdaiya commented 10 years ago

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.

charlescui commented 10 years ago

Good job @cubicdaiya !

mibamur commented 10 years ago

@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

0) First, not nil. - Make small changes for mruby_nginx_module documentation: install script-text, add more example with nginx.conf_templates

1) Analyze lua and perl binding work with nginx "API"

2) List available features from lua, perl - make one tables = who.where.how

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

4) make visual scheme - for better understanding

5) update from trunk nginx_dev_module for last nginx sources (1.4, 1.5)

6) benchmark all, test each other: lua, mruby, perl, native - redis, memcache, pg, drizzle

8) nginx patches from Openresty for Linux (Sysoev married FreeBSD)

9) 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

cubicdaiya commented 10 years ago

@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.