You *can* get it to behave the way I explained.
By adding more than just "Search" Actions or SELECTs to the code inside
of the transaction.  You have to have something that creates a
dependency.  For example, I can't do a read in hitsecond.taf, because
someone else may have done a write in hitfirst.taf.

I'll attach another screenshot showing a situation where the second taf
doesn't finish until the first one leaves the transaction, but then i'll
be quiet.

:)

/John


John McGowan wrote:


never mind about my post below... The transactions do what they're supposed to do, isolate the database transactions from eachother, but they do not do what I proposed below. The second hit finishes before the first hit.

If your problem is that you don't want more than 1 DB transaction going on ever, could this be handled by limiting the number of connections to the database to 1 connection?

/John

John McGowan wrote:

Why aren't you just using the DB Transactions? I think the assumptions you made about Witango 5 vs T2K and how the threading affects the use of those are false. We've been using Begin and end transactions without any problem. And have been running W5 for quite some time.

If you want to prove it to yourself, do what I did. Use the suggestions earlier in this thread to do an external action that waites for some period of time.


Create 2 tafs like the ones in the screenshot I've attached. (hitfirst.taf and hitsecond.taf)


if threading and transactions don't work properly, hitsecond.taf should return results before hitfirst.taf You won't see that though. The actions in side of the transaction block of hitfirst.taf will have to complete before the hitsecond.taf will enter the block.

just because a thread pre-empts doesn't mean that another thread waiting for it to complete will not continue to wait.

I would argue that the "old" threading method of witango allowed many people to "get away" without using transactions (unless they were running on multiple processors or multiple servers) And the real use for transactions only comes now that we have a truly threaded application server.

Anyone disagree with this?

/John

[EMAIL PROTECTED] wrote:



Yes, I am using MS SQL but I thought I'd rather not use SPs to keep the code
transportable. It was also one of the recommendations in the old Tango 2000
documentation.


I was afraid of getting these answers...
We are now talking redesign...
I wish I knew better what I was getting into.

Thank you for all your input; it really helps.
- Mike.


-----Original Message-----
From: Robert Shubert [mailto:[EMAIL PROTECTED] Sent: Thursday, April 22, 2004 14:43
To: [EMAIL PROTECTED]
Subject: RE: Witango-Talk: Sleep & While + explanations


One thing to note is that BT/ET actions are very robust with the right
database, and can be trusted.

Also, look into stored procedures, and using internal (to the SP)
transactions. Rather than using a variable to block further db access, use a
value in a table (controlled by the SP).


Better yet, just do everything in the SP and let the DB worry about the
overhead, they are much faster for most things.

Robert
-----Original Message-----
From: Scott Cadillac [mailto:[EMAIL PROTECTED] Sent: Thursday, April 22, 2004 14:39
To: [EMAIL PROTECTED]
Subject: RE: Witango-Talk: Sleep & While + explanations


Thank you Mike,

Now I'm seeing a bigger picture for what you're up against.

Yes, the new Threading model in Witango 5.0, although greatly more efficient
in many respects, can introduce timing issue with controlling Transaction
"blocks".


I haven't seen mentioned what Database you're using?

For such a fine need of control, Stored Procedures in SQL Server, for
example, can help.
A Stored Procedure will execute much faster than a series of Database
Actions, which could go a long way to eliminating timing/resource conflicts.


Hope this helps. Cheers...





-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Thursday, April 22, 2004 3:15 PM
To: [EMAIL PROTECTED]
Subject: RE: Witango-Talk: Sleep & While + explanations


Thank you all for your suggestions and comments.


My confusion is generated by the fact that I do not know how to control the DB access anymore.
In Tango 2000, it was (relatively) simple. Using "Begin Transaction/End Transaction" I knew that all other processes would not use the DB while my writing operation (for ex.), and the thread would not have been suspended while doing this.


In V5.0, if I understand this correctly:
1- there is no way to guarantee, the thread will not be interrupted while processing inside BT/ET; and
2- there is no way of knowing if the BT/ET has already started in a another switched-out thread, unless I design & use some method to synchronize threads (just like a mutex, for ex.).


My goal was to associate a variable with the exclusive rights to the DB.
For ex. if the variable>0 it shows the DB is locked, I can wait in a loop, using sleep() for a few ms; When the variable=0 I can increment it, and then check if variable=1, lock the DB for exclusive access, etc.
I do not believe that using the available metatags I can have such a fine control over the process to avoid dead locks or race conditions; but it is seems better than not trying to control it at all.
(There is probably a good reason why .NET implemented so many classes to prevent mishandling of threads.)


Of course I might be wrong on all accounts.


Mike.


-----Original Message-----
From: Scott Cadillac [mailto:[EMAIL PROTECTED]
Sent: Thursday, April 22, 2004 12:25
To: [EMAIL PROTECTED]
Subject: RE: Witango-Talk: Sleep & While + explanations

Hi Mike,



I am a little confused by your response, since my question was in regard to sleep( milliseconds), which I need in order to


save CPU in a


loop that checks resource availability. Any browser would wait just fine for a couple of hundred milliseconds.


If this is the case, why put the check into a loop at all?

If the system needs a tiny bit of time before the resource can respond, then just let it run as is.

I understand "why" you want a sleep() function, but I would consider carefully it's implications before using it in a Web application.




BTW, I am doing exactly what you suggest, rethinking my


application.

Until now it worked just fine, under Tango 2000, never had


a problem.

It still works OK now, under Witango 5 in a test environment, but I feel uneasy to move it into the production because I did


not test it


in a real, multiuser environment. The big problem is I lack understanding of how to deal with multi-threading when no


controlling


mechanism is available for managing threads.


I guess we must be missing a piece of the puzzle here, as to specifically what multi-threading concerns you have.

If the issue revolves around a particular database query that has a habit of taking a long time, then you will be happy to learn that "threading" under Witango 5.x Servers are greatly improved.

Tango2000 used "co-operative" threading, whereas Witango 5.x uses "pre-emptive" threading. This is an automatic build-in feature of the Server.

If resources get scarce, then Witango will respond with greater speed and efficiency then Tango2000 ever can.

The CPU usage spawned by the "waiting" will be reasonably managed - if it's not, then this is the point where "I" would rethink what I'm doing.

But yes, managing your own Threading is a great advantage too
- I also do
NET development. But even with this kind of power, if a process is going to routinely take a long time, then it's time to rethink the application design.


I recently did a Custom Reporting application. Another department of my customer was supplying these huge XML files full of Financial figures (200mb+), and my Web app was dynamically parsing the XML for particular content and displaying them for the web - simple enough work.

But....the processing was incredibly time/CPU intensive for each request, because the files were so huge, that the user was waiting up to 10 seconds for responses.

So, I did a complete rebuild of the project where I built a Windows Service application that pre-parsed the XML files into smaller more manageable chunks. Instead of one big file, I now have 200 tiny ones.

The project got carried away because the sample XML files I started with were less than 1mb - next time I'll think further ahead.

Hope this helps....





Mike Bravu.

-----Original Message-----
From: Scott Cadillac [mailto:[EMAIL PROTECTED]
Sent: Thursday, April 22, 2004 11:03
To: [EMAIL PROTECTED]
Subject: RE: Witango-Talk: Sleep & While + explanations

Hi Mike,

With regards to your wishful thinking of a sleep() function in Witango, I think you need to rethink your application a bit.

Regardless of the development platform that may, or may


not, support a


"sleep" or "wait" process - the client component (browser) of your "Web"
application has limited tolerance for such a thing.


Browsers don't like waiting. Although you can craft some


special HTTP


output to make a browser wait (checkout the "Push" attribute), the results are not always User friendly.

I would suggest building a special webpage/window that periodically "checks"
with the Server if the requested resource is free yet. You


can do this


with JavaScript, or with a META Refresh - and also provide


Users with


intelligent messages.

I know this is not a simple solution from a developer point


of view,


because it's more in the interest of the end-user - but who said programming would be easy?

-----
And although it has been a long time coming, I understand


an <@WHILE>


Meta tag will be coming in version 5.5 (or 6.0?).


Hope this helps. Cheers.... (Note: new phone number April 26th: 403-254-5002)

Scott Cadillac,
403-281-6090 ~ [EMAIL PROTECTED]
------------
XML-Extranet ~ http://xmlx.ca ~ http://forums.xmlx.ca Well-formed Programming in C# .NET, Witango, MSIE and XML
------------
IExtranet ~ http://iextranet.ca
Witango ~ http://witango.org
EasyXSLT ~ http://easyxslt.ca
IIS Watcher ~ http://iiswatcher.ca
------------




________________________________

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, April 22, 2004 10:25 AM
To: [EMAIL PROTECTED]
Subject: RE: Witango-Talk: Sleep & While + explanations
I need sleep() (on the server side) to wait for


availability on a


locked resource ( without loading the CPU ).
If I use an external procedure (dos wait) I am not sure


what is the


delay needed to load the DOS interpreter; and I would prefer not to bind the the solution to an OS. Java can solve all this


(provided it


is already
loaded) but I was curious to see if somebody found a simpler way.
I was aware of while action and that would work just


fine; however


that means I end up fragmenting a results page action; I'd


rather use


<@FOR> if I can make it act as a while (which can be done in all programming languages that I know), but I found no way to


do that with


witango.
I wonder, since there are <@TIMER> and <@FOR> metatags, why not <@SLEEP> and <@WHILE> as well? They are obviously closely


related and


I assume they cannot be that difficult to implement...
                  Thank you for all your suggestions.
    Mike Bravu.
              ________________________________

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, April 22, 2004 03:28
To: [EMAIL PROTECTED]
Subject: Witango-Talk: Sleep & While
Hello all,
Can anybody help me out with the Witango equivalents for:
1- sleep( milliseconds ); and
2- while( true ) { }
The solutions that I found are not acceptable:
1- except for using externals, if I try to use


<@TIMER> it seems I


burn the CPU, which is not what I want;
2- <@FOR> </@FOR> does not really work or I do not know how to


setup


Start/Step/Stop
If the solution is already explained in the documentation I apologize, I just could not find it.
Thank you,
Mike Bravu
______________________________________________________________
__________
TO UNSUBSCRIBE: Go to
http://www.witango.com/developer/maillist.taf
______________________________________________________________
__________
TO UNSUBSCRIBE: Go to
http://www.witango.com/developer/maillist.taf



______________________________________________________________ __________ TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf

______________________________________________________________
__________
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf



______________________________________________________________
__________
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf

______________________________________________________________
__________
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf





________________________________________________________________________

TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf

________________________________________________________________________

TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf




________________________________________________________________________ TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf

------------------------------------------------------------------------


________________________________________________________________________ TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf



________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf

<<inline: threadexample2.jpg>>

Reply via email to