couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benoit Chesneau (JIRA)" <j...@apache.org>
Subject [jira] Commented: (COUCHDB-855) New host manager
Date Fri, 28 Jan 2011 12:54:43 GMT

    [ https://issues.apache.org/jira/browse/COUCHDB-855?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12988064#action_12988064
] 

Benoit Chesneau commented on COUCHDB-855:
-----------------------------------------

Just used curl + xargs with file edited to display times. But yes so :

- gen_srever give a constant time until the number of concurrent requests become high. That
sound logical s-ince it's serialized. Speed is relatively constant because it doesn't have
to reparse config each time.

 There are not so many service that handle 1000 simultaneous requests but well, I'm too for
the version without gen_server. It works now due to previous change  in couch_httpd on config
changes handling.

Now the last bit to solve is the call to the application:get_env/set_env. Paul is in favor
of using a gen_server for that. Other methode I can see, which is used in some other projects
is to use ets:

ets:new(?MODULE, [named_table, public]) ....

If we use a generic gen_server it may be used for other purposes I guess. I've no preference
for on or the other. Except that we shouldn't use too much ets which was the reason I used
application module functions.


> New host manager
> ----------------
>
>                 Key: COUCHDB-855
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-855
>             Project: CouchDB
>          Issue Type: Improvement
>    Affects Versions: 1.1
>            Reporter: Benoit Chesneau
>            Assignee: Benoit Chesneau
>            Priority: Blocker
>             Fix For: 1.1
>
>         Attachments: 0001-New-vhost-manager.-allows-dynamic-add-of-vhosts-with.patch,
0001-Squashed-commit-of-the-following.patch, COUCHDB-855-1.patch, COUCHDB-855-2.patch
>
>
> New vhost manager. allows dynamic add of vhosts without restart, wildcard in vhost and
specific functions in erlang by kind of domain. It also fix issue in etap test (160) .
> Find attached to this ticket the patch. It is also available in my github repo :
> http://github.com/benoitc/couchdb/commit/435c756cc6e687886cc7055302963f422cf0e161
> more details :
> This gen_server keep state of vhosts added to the ini and try to
> match the Host header (or forwarded) against rules built against
> vhost list. 
> Declaration of vhosts take place in the configuration file :
> [vhosts]
> example.com = /example
> *.example.com = /example
> The first line will rewrite the rquest to display the content of the
> example database. This rule works only if the Host header is
> 'example.com' and won't work for CNAMEs. Second rule on the other hand
> match all CNAMES to example db. So www.example.com or db.example.com
> will work.
> The wildcard ('*') should always be the last in the cnames:
>      "*.db.example.com = /"  will match all cname on top of db
> examples to the root of the machine. (for now no rewriting is
> possible).
> By default vhosts redirection is handle by the function
> couch_httpd_vhost:redirect_to_vhost, but you could pass per vhost a
> specific function :
>      "*.domain.com" = {Module, Func}"
> The function take the Mochiweb Request object and should return a new
> Mochiweb Request object.
> You could also change the default function to handle request by
> changing the setting `redirect_vhost_handler` in `httpd` section of
> the Ini:
>       [httpd]
>       redirect_vhost_handler = {Module, Fun}
> The function take 2 args : the mochiweb request object and the target
> path. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message