Am 04.02.14 01:35, schrieb Stephen:

On Mon, Feb 3, 2014 at 2:40 PM, Gustaf Neumann <neum...@wu.ac.at <mailto:neum...@wu.ac.at>> wrote:


    converting ns-sets naively into local variables will clobber other
    locals,
    using some strange array names etc. would still require to modify
    all functions accessing the ns-sets, or passing the ns-sets around
    etc.



db_foreach already unpacks it's row sets into local variables.
somehow we are arguing in circles. yes, db_foreach does it.
When dbi is used for OpenACS, there are situations, where
one wants set all column values into local variables (as it is
the case when implementing db_foreach on top of dbi), there are other
cases, where one does not want this, therefore dicts, sets, etc
are needed.
Without a C implementation only Tcl command dispatch overhead is being tested.
sorry, did not have the time so far to implement the structure conversion
routines in C. By implementing this in C, one make more optimizations
when processing the flat list, since the is no need to set the columns
into local variables (what the "foreach $columns ..." does), etc.
Maybe i find some time-slots towards end of the week or on
the weekend.

    in our current production environment (with ns_db) requests to the
    application server require on average about 9 SQL queries
    (but up to *700* SQL queries uncached for the personalized start
    page).



This is what happens when you make it easy to nest db_foreach :-)
you are quick in drawing conclusions. About 10% of these SQL
queries are from setup (obtaining names of user, communities,
applications, ...), 40 % are from collecting and summarizing
information from about 50 communities  (courses,
organizational units, clubs, ...) and the largest number is
from permission checking. With a warm cache, less than 10%
of the queries are needed in the current implementation (which
can/should/will be improved)

It is "real world" code. By replacing db_foreach by a dbi_rows,
the number of queries won't change, the nesting can be reduced
slightly (the 700 SQL queries use two handles, with the warm
cache, one handle).

-gn

------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
_______________________________________________
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel

Reply via email to