Dossy wrote:

> On 2001.12.23, Wojciech Kocjan <[EMAIL PROTECTED]> wrote:
>
>>Ok, I'll explain how I do it currently with mod_dtcl in detail:
> Neat.  I've implemented mine very similiarly to yours.


Great.

> No merging when users log in, and logout just expires the session ID
> cookie.  I call mine "UID" -- I'll probably make the cookie name
> configurable soon.  There's no reason to create a new session ID --
> a new one gets created when the user accesses another page since
> their old session ID cookie was expired.
>
>
>>The basic idea is that if someone cares about his session data, he'll
>>log in. If he doesn't have a user, he'll eventually create one.
>>
>
> My problem is if the same user logs in from two different places ...
> how do you merge the two sessions.  Maybe that's an application-specific
> problem and not something you can solve in a general fashion...


Hmmm. When a user logs in, he gets a new cookie with a new SID. So both
of them send the same SID and both of them will have the same session
settings/data. This shouldn't be a problem. I want to implement nsession
eval (similar to ns_cache eval) so that data can (but does not have to)
be modified by one thread at a time.

>>Also, my previous implementation had a cleanup algorithm and expire
>>parameter. The new one is not even close to being final version, so a
>>lot is missing.
>>
>
> Hopefully soon I'll get around to writing a scheduled proc that'll
> clean up the in-memory session data (held in nsv structures) and
> an expire proc that purges old session data after inactivity.
>
>
>>The problem is that currently I do not even try to check if a user
>>accepts cookies - this can create a mess.


> No kidding.  A new session will be created every time they access
> a page.  Absolutely miserable.


How do you deal with that?

Actually my code deals with it quite good - a session without any
attributes is simply not saved at all - however it does consume memory :(

> I ran into a browser bug with Netscape ... if your webserver is
> just foodomain.com (and not www.foodomain.com) Netscape won't
> let you set a cookie.  It looks for two periods in a hostname
> if it's one of the "big 7 TLDs" (you know, COM, NET, ORG, etc.)
> and three periods if it's a ccTLD (.nj.us, .it, etc.)


Hmmm, very odd. I mostly use www.domain.pl (even used http://zoro2.org)
and NN4 did not make any problems at all for me.

> but Microsoft Internet Explorer doesn't have this problem (security
> hole?) ... yet again, why Netscape 4.x sucks so bad ...


I use windows and mozilla (that is, mozilla on windows :). I like this
browser and with quicklaunch it works quite fast.

> (Of course, there's no port of MSIE to Linux, argh.)


I'm considering buying VMware Workstation - emulating Linux server on a
Windows 2000 host. But the price isn't that low :(


>>I'll try and put it online sometime soon (hey, it's christmas, don't
>>have too much time :).
> I know ... but I'm finding more time now since I'm not working,
> so I figured I'd take advantage of it.


Hehe. I'm always working ;-(

>>Also, in my previous implementation, there was no nsv/permament storage.
>> My new code uses Ns_Mutex and my own code to store data and has a
>>separate thread for synchronization to disk - if the sessions go above a
>>predefined limit, some of them will be saved on disk.

> Because sessions are mostly read-only (mine are, at least) I have
> it set so that any writes to session data cause a write to persistent
> storage.  If this poses to be a bottleneck (or a concurrency issue)
> I'll address it later.


I use sessions for about 70% read 30% write. And I want the code to be
quite robust (since sessions do not need too many neat features ;-).

> Hmm.  I'd be curious to try some benchmarks of my version (which is
> pure Tcl) vs. yours in C.


A simple helloworld+counter was about 5% slower than a simple hello
world when I told ab to send session by hand.

btw Do you know any good http benching software that supports cookies in
  a convenient way? :)

> I'd be willing to bet that the ability
> to extend my implementation rapidly will outweigh any performance
> gains your C implementation might offer.


That depends. I learnt that Tcl+C offers the best
performance/exdending_speed compromise (I wrote a quite fancy name-based
vhosting module that way - it uses tcl to resolve domain->path and
caches it - under 1% performance loss to not using the module).

Anyway, I assumed that sessions aren't that complex and can be written
in pure C. We can bench and compare things if you want to. I'm also
curious about the difference in performance.

> Lets put our heads together, and try getting something that people
> can start using -- not everyone needs or wants to use ACS ...


Definitely so. I tried OpenACS but it looked a bit too complex for me ;-)

Besides, I'd like to see some modules that allow half the stuff ACS does
- like news, forums, downloads, but as a nice Tcl module - so that I can
put something like <%=[z.news::latest]%> in my code :)

--
WK

Reply via email to