On 6/19/06, Vlad Seryakov <[EMAIL PROTECTED]> wrote:
Also, what is wrong with per-cache expiration policy, nc_cache_create
-timeout parameter.
How i can create 2 caches with different expiration settings?


Nothing particularly, but there's a better way to do it:

Look at the aolserver head, at nsd/limits.c.  A 'limits' is a
collection of setting such as max upload size, timeout etc.  You
create one or more of these then bind them to a URL, just like
ns_register_proc.

The timeout in the aolserver implementation refers to just the time
waiting for a conn thread.  I'm going to extend that to mean total
time allowed for the conn to run.

So, you might set timeout to be 30 seconds.  You bind this to /*, i.e.
every URL.  Now, when you use a cache, or ns_proxy, or ns_db, or in
fact anything where a timeout is needed, and you haven't specified
anything expliciltly using a  -timeout switch, the limits are used.

This is actually more what you want -- you're defining the quality of
service you expect to give.  I made some changes recently so that Tcl
code which times out in this way throws a particular error code. This
is picked up by the server and turned into the appropriate HTTP
'server busy' code.

To get this working, Ns_Conn structs need to be allocated in driver.c,
not queue.c as they are now.  driver.c is looking a little scary...



 >Ns_CacheGetConfig removed -- caches are immutable; the current
 > settings can be looked up in the config file.

This is not absolutely true if nothing in the config and i need to find
out default compiled-in value. GetConfig gives runtime value regardless
of what is set or not set in the config file. With per-cache timeout
this makes sense. How limits are supposed to work?


Don't compile in defaults, use Ns_ConfigGet* etc.


Stephen Deasey wrote:
> Update of /cvsroot/naviserver/naviserver
> In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv27993
>
> Modified Files:
>       ChangeLog
> Log Message:
>         * nsd/fastpath.c:
>         * nsd/adpeval.c: Use Ns_CacheDeleteEntry instead of
>         Ns_CacheFlushEntry to prevent genuine flush stats being inflated.
>
>         * tcl/cache.tcl:
>         * nsd/nsconf.c:
>         * nsd/dns.c: Update to new API.
>
>         * nsd/nsd.h:
>         * nsd/server.c: Remove tcl cache timeout param in anticipation of new
>         limits API.
>
>         * nsd/tclcmds.c: Remove ns_cache _get _set _exists _info
>         commands. The first three are racey and can be emulated with _eval
>         and the new -force switch.  The new -contents switch to the _stats
>         command replaces _info, discouraging racey check-and-set usage.
>
>         * nsd/tcltime.c:
>         * nsd/tclobjv.c: New Ns_ObjvTime parse callback for the Ns_Time
>         type. Handy for passing absolute time deadlines to routines which
>         timeout.
>
>         * include/ns.h:
>         * nsd/cache.c: New Ns_CacheResetStats routine.
>
>         Ns_CacheGetConfig removed -- caches are immutable; the current
>         settings can be looked up in the config file.
>
>         Directly expire entries from within all routines which return one,
>         but but only if the value is not null, indicating no concurrent
>         update is in progress.
>
>         Use Ns_CacheDeleteEntry to remove an entry from the cache without
>         updating the stats. Flush stats should reflect explicit flushes
>         only.
>
>         Log stats when a cache is destroyed.
>
>         * nsd/tclcache.c: ns_cache_create now takes a -maxentry option
>         which is the maximum size of an entry allowed in the cache. This
>         prevents one large entry completely emptying an otherwise usefully
>         full cache.
>
>         The ns_cache_create -timeout switch has been removed in
>         anticipation of a general purpose limits scheme.
>
>         The -timeout option is now expected to be an absolute time in the
>         future, not an offset from the current time. This is awkward to
>         use manually, but should not be needed with the above mentioned
>         limits scheme. The -ttl option has been renames -expires and is
>         also an absolute time.
>
>         ns_cache_eval now takes a -force switch which will unconditioanly
>         replace any exiting entry, whether it has expired or not. Replaces
>         _set.
>
>         ns_cache_stats -content dumps the size and expirey for each
>         entry in the cache. Adding the -reset switch to either mode resets
>         the stats to zero.
>
>         * tests/ns_cache.test: Try to exercise the underlying Ns_CacheFind
>         harder with some more flush tests.
>
>
>
> Index: ChangeLog
> ===================================================================
> RCS file: /cvsroot/naviserver/naviserver/ChangeLog,v
> retrieving revision 1.405
> retrieving revision 1.406
> diff -C2 -d -r1.405 -r1.406
> *** ChangeLog 19 Jun 2006 19:05:47 -0000      1.405
> --- ChangeLog 19 Jun 2006 21:16:38 -0000      1.406
> ***************
> *** 1,2 ****
> --- 1,71 ----
> + 2006-06-19  Stephen Deasey  <[EMAIL PROTECTED]>
> +
> +     * nsd/fastpath.c:
> +     * nsd/adpeval.c: Use Ns_CacheDeleteEntry instead of
> +     Ns_CacheFlushEntry to prevent genuine flush stats being inflated.
> +
> +     * tcl/cache.tcl:
> +     * nsd/nsconf.c:
> +     * nsd/dns.c: Update to new API.
> +
> +     * nsd/nsd.h:
> +     * nsd/server.c: Remove tcl cache timeout param in anticipation of new
> +     limits API.
> +
> +     * nsd/tclcmds.c: Remove ns_cache _get _set _exists _info
> +     commands. The first three are racey and can be emulated with _eval
> +     and the new -force switch.  The new -contents switch to the _stats
> +     command replaces _info, discouraging racey check-and-set usage.
> +
> +     * nsd/tcltime.c:
> +     * nsd/tclobjv.c: New Ns_ObjvTime parse callback for the Ns_Time
> +     type. Handy for passing absolute time deadlines to routines which
> +     timeout.
> +
> +     * include/ns.h:
> +     * nsd/cache.c: New Ns_CacheResetStats routine.
> +
> +     Ns_CacheGetConfig removed -- caches are immutable; the current
> +     settings can be looked up in the config file.
> +
> +     Directly expire entries from within all routines which return one,
> +     but but only if the value is not null, indicating no concurrent
> +     update is in progress.
> +
> +     Use Ns_CacheDeleteEntry to remove an entry from the cache without
> +     updating the stats. Flush stats should reflect explicit flushes
> +     only.
> +
> +     Log stats when a cache is destroyed.
> +
> +     * nsd/tclcache.c: ns_cache_create now takes a -maxentry option
> +     which is the maximum size of an entry allowed in the cache. This
> +     prevents one large entry completely emptying an otherwise usefully
> +     full cache.
> +
> +     The ns_cache_create -timeout switch has been removed in
> +     anticipation of a general purpose limits scheme.
> +
> +     The -timeout option is now expected to be an absolute time in the
> +     future, not an offset from the current time. This is awkward to
> +     use manually, but should not be needed with the above mentioned
> +     limits scheme. The -ttl option has been renames -expires and is
> +     also an absolute time.
> +
> +     ns_cache_eval now takes a -force switch which will unconditioanly
> +     replace any exiting entry, whether it has expired or not. Replaces
> +     _set.
> +
> +     ns_cache_stats -content dumps the size and expirey for each
> +     entry in the cache. Adding the -reset switch to either mode resets
> +     the stats to zero.
> +
> +
> +
> +
> +
> +     * tests/ns_cache.test: Try to exercise the underlying Ns_CacheFind
> +     harder with some more flush tests.
> +
>   2006-05-19  Vlad Seryakov  <[EMAIL PROTECTED]>
>
>
>
>
> _______________________________________________
> naviserver-commits mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/naviserver-commits
>

--
Vlad Seryakov
571 262-8608 office
[EMAIL PROTECTED]
http://www.crystalballinc.com/vlad/



_______________________________________________
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Reply via email to