Are "On Web Connection" and/or "On Web Authentication" multi-threaded?

View: New views
13 Messages — Rating Filter:   Alert me  

Are "On Web Connection" and/or "On Web Authentication" multi-threaded?

by Steve Makohin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello everyone,

I've done some tests that confirm processes started by 4D's New Process
command are not multi-threaded. They will all run on a single core,
regardless of the number of cores on the computer. This is true of 4D in
remote mode (client, of client/server) and of 4D Server v11.4 (and older).

The 4D database engine, however, is multi-threaded, so it can take advantage
of as many cores as you throw at it. Great for client-server interaction.
But here's the web-related question:

Does anyone know if 4D's On Web Connection and On Web Authentication
database methods run multi-threaded, like database processes (e.g.,
searches), or whether they run non-multi-threaded, like methods launched via
the New Process command? I *suspect* the latter. I just need a confirmation.

Thanks in advance.

-Steve Makohin
 Oakville, Ontario, Canada

_______________________________________________
Active4D-dev mailing list
Active4D-dev@...
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

Re: Are "On Web Connection" and/or "On Web Authentication" multi-threaded?

by Peter Schumacher-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Steve,

all the web stuff is running in the "old" mode, single threaded. A  
QUERY can use multi-cores. This was changed in 11.4. The port number  
is a good indicator:

These ports are "old stuff":
80, 8080 ... all the webports, or better, ports you use for web (http/
https)
19813

Other ports like 19814 used for the SQL server indicate,that it is  
running multi-threaded, multi-core

Am 25.05.2009 um 05:28 schrieb Steve Makohin:

> Does anyone know if 4D's On Web Connection and On Web Authentication  
> database methods run multi-threaded, like database processes (e.g.,  
> searches), or whether they run non-multi-threaded, like methods  
> launched via the New Process command? I *suspect* the latter. I just  
> need a confirmation.

Greetings,
[4D-Consulting.com]eK, Wiesbaden (Germany)
Peter Schumacher
--------------------------------------------------------
Web: http://www.4D-Consulting.com/
FreeCall:  0800-434 636 7
Tel.:      +49-611-9406.850 - Fax: +49-611-9406.744
4D-Consulting.com eK - Scharnhorststr. 36 - 65195 Wiesbaden
Member of the German Developer Network  http://www.die4dwerkstatt.de









_______________________________________________
Active4D-dev mailing list
Active4D-dev@...
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

Re: Are "On Web Connection" and/or "On WebAuthentication" multi-threaded?

by Steve Makohin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Peter,

From: "Peter Schumacher" <plist@...>

> Am 25.05.2009 um 05:28 schrieb Steve Makohin:
>
>> Does anyone know if 4D's On Web Connection and On Web Authentication
>> database methods run multi-threaded, like database processes (e.g.,
>> searches), or whether they run non-multi-threaded, like methods  launched
>> via the New Process command? I *suspect* the latter. I just  need a
>> confirmation.
>
> all the web stuff is running in the "old" mode, single threaded. A  QUERY
> can use multi-cores. This was changed in 11.4. The port number  is a good
> indicator:
>
> These ports are "old stuff":
> 80, 8080 ... all the webports, or better, ports you use for web (http/
> https)
> 19813
>
> Other ports like 19814 used for the SQL server indicate,that it is
> running multi-threaded, multi-core

Thank you for the confirmation, and for your speedy reply. So this is a
bottle-neck in 4D web deployments.

-Steve Makohin
 Oakville, Ontario, Canada

_______________________________________________
Active4D-dev mailing list
Active4D-dev@...
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

Re: Are "On Web Connection" and/or "On WebAuthentication" multi-threaded?

by aparajita :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> Thank you for the confirmation, and for your speedy reply. So this  
> is a bottle-neck in 4D web deployments.

It's a bottleneck only if you have *very* high volume on your site.

Regards,

    Aparajita
    www.aparajitaworld.com

    "If you dare to fail, you are bound to succeed."
    - Sri Chinmoy   |   www.srichinmoy.org

_______________________________________________
Active4D-dev mailing list
Active4D-dev@...
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

Re: Are "On Web Connection" and/or "OnWebAuthentication" multi-threaded?

by Steve Makohin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Aparajita and list,

From: "Aparajita Fishman" <aparajita@...>

>> Thank you for the confirmation, and for your speedy reply. So this  is a
>> bottle-neck in 4D web deployments.
>
> It's a bottleneck only if you have *very* high volume on your site.

I am just beginning my adventure into web development with 4D, so please
forgive me for my ignorance in this area. My understanding is as follows: If
the nature of the web application is such that it requires a fair bit of
computational work, and that work is done in 4D code, then that code, for
all web users, will be executed on a single CPU core. So if we create a
scenario in which 10 concurrent web users, each executing a
processor-intensive task, can max out a single core for 5 seconds (they
experience a 5 seconds response time), then that means 20 users executing
the same task concurrently will take about 10 seconds to complete it (10
seconds response time, about double). This is due to 4D's non-multi-threaded
code, and not to the 4D database, Active4D, or other factors.

Is my understanding basically correct? If so, then your term "very high
volume" can mean a lot of concurrent users doing very little work, as well
as relatively few users concurrently executing processor-intensive tasks.

This is not a slam of 4D, but rather a "need to know" so I can architect my
system to compensate for this.

-Steve Makohin
 Oakville, Ontario, Canada

_______________________________________________
Active4D-dev mailing list
Active4D-dev@...
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

Re: Are "On Web Connection" and/or "OnWebAuthentication" multi-threaded?

by aparajita :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> So if we create a scenario in which 10 concurrent web users, each  
> executing a processor-intensive task, can max out a single core for  
> 5 seconds (they experience a 5 seconds response time), then that  
> means 20 users executing the same task concurrently will take about  
> 10 seconds to complete it (10 seconds response time, about double).  
> This is due to 4D's non-multi-threaded code, and not to the 4D  
> database, Active4D, or other factors.

The web CPU load is not as high as you think. Active4D can typically  
serve about 4 requests per second, and 25% of that time is spent by  
the database engine.

Regards,

    Aparajita
    www.aparajitaworld.com

    "If you dare to fail, you are bound to succeed."
    - Sri Chinmoy   |   www.srichinmoy.org

_______________________________________________
Active4D-dev mailing list
Active4D-dev@...
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

Re: Are "On Web Connection" and/or"OnWebAuthentication" multi-threaded?

by Steve Makohin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Aparajita and list,

From: "Aparajita Fishman" <aparajita@...>

>> So if we create a scenario in which 10 concurrent web users, each
>> executing a processor-intensive task, can max out a single core for  5
>> seconds (they experience a 5 seconds response time), then that  means 20
>> users executing the same task concurrently will take about  10 seconds to
>> complete it (10 seconds response time, about double).  This is due to
>> 4D's non-multi-threaded code, and not to the 4D  database, Active4D, or
>> other factors.
>
> The web CPU load is not as high as you think. Active4D can typically
> serve about 4 requests per second, and 25% of that time is spent by  the
> database engine.

Thank you for your quick response.

Granted, Active4D is respectably zippy, but I am thinking of a scenario in
which the user submits a page, Active4D does its work quickly, but then 4D
code is called upon to carry out some computation-intensive work. The
machine on which that 4D code is executing, likely 4D Remote talking to the
4D server, will execute all such code, from all web users, on one CPU core.
Correct?

Again, I highlight that I am *planning* for web development using Active4D
for 4D v11 (to come in the future), and I have not yet done any Active4D
development.

-Steve Makohin
 Oakville, Ontario, Canada

_______________________________________________
Active4D-dev mailing list
Active4D-dev@...
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

Re: Are "On Web Connection" and/or"OnWebAuthentication" multi-threaded?

by aparajita :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> Granted, Active4D is respectably zippy, but I am thinking of a  
> scenario in which the user submits a page, Active4D does its work  
> quickly, but then 4D code is called upon to carry out some  
> computation-intensive work.

Perhaps it would help us to know what this application is that will  
require so much cpu. A typical web application does a query and shows  
some results. This typically takes a second or less.

Regards,

    Aparajita
    www.aparajitaworld.com

    "If you dare to fail, you are bound to succeed."
    - Sri Chinmoy   |   www.srichinmoy.org

_______________________________________________
Active4D-dev mailing list
Active4D-dev@...
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

Re: Are "On Web Connection" and/or "On Web Authentication" multi-threaded?

by Mehboob Alam :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


> I've done some tests that confirm processes started by 4D's New Process command are not multi-threaded.

I'm sorry that you had to go through the trouble to create tests and confirm this. It is public knowledge that the 4D language engine is single-threaded (cooperatively tasked), and this will not change in the future.

If you need to create a large scalable system, you can create multiple "4D RUNTIME" instances that communicate to a single "4D SERVER" via SQL, and get the maximum of your multi-core server.

Keep in mind, the 4D Server license is priced accordingly, an additional license per core. You may want to price out your multi-core capable server license with 4D before you continue architecting your system.

 sincerely,
mehboob alam




Electricity is actually made up of extremely tiny particles called electrons, that you cannot see with the naked eye unless you have been drinking. - Dave Barry



----- Original Message ----
From: Steve Makohin <wateredg@...>
To: active4d-dev@...
Sent: Sunday, May 24, 2009 11:28:22 PM
Subject: [Active4d-dev] Are "On Web Connection" and/or "On Web Authentication" multi-threaded?

Hello everyone,

I've done some tests that confirm processes started by 4D's New Process command are not multi-threaded. They will all run on a single core, regardless of the number of cores on the computer. This is true of 4D in remote mode (client, of client/server) and of 4D Server v11.4 (and older).

The 4D database engine, however, is multi-threaded, so it can take advantage of as many cores as you throw at it. Great for client-server interaction. But here's the web-related question:

Does anyone know if 4D's On Web Connection and On Web Authentication database methods run multi-threaded, like database processes (e.g., searches), or whether they run non-multi-threaded, like methods launched via the New Process command? I *suspect* the latter. I just need a confirmation.

Thanks in advance.

-Steve Makohin
Oakville, Ontario, Canada
_______________________________________________
Active4D-dev mailing list
Active4D-dev@...
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/



     
_______________________________________________
Active4D-dev mailing list
Active4D-dev@...
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

Re: Are "On Web Connection"and/or"OnWebAuthentication" multi-threaded?

by CDonahue :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> A typical web application does a query and shows some results. This
typically takes a second or less.

This is probably a bit of an oversimplification ... web applications are
not simply front-ends for database management, or information browsers.
Ideally, yes - there are some query parameters and a search is done. The
recipe, picture, calendar, etc. is pulled and displayed. This of course
requires that the data be readily available in its "display" form. Look
at travel sites (Orbitz) - they throw up a five or ten second splash
screen and limit your other requests while they are gathering
information.

I mention this because we are in a similar situation - a fairly small
number web requests, each requiring an extensive amount of computation
to provide a result. We *do* cache this end result, so that most of the
time a single query will bring up the desired page. However, data is
shifting and we cannot cache everything ahead of time. Thus, an
un-cached request will come in and consume the server for 10-15 seconds.
Not bad. However, when ten of these requests are suddenly fighting for
resources within the same web process, this causes problems.

In the end, the single 4D language thread is a bottleneck. You can
definitely help out the situation: Using multiple RUNTIME instances was
a good idea. So is using an Apache server as a reverse proxy to serve
static pages. This takes some of the load off of 4D so that it can
concentrate on "application" pages.

- Clayton

_______________________________________________
Active4D-dev mailing list
Active4D-dev@...
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

Re: Are "On Web Connection"and/or"OnWebAuthentication" multi-threaded?

by B. Perkins :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

In reading this thread I see a number of issues here.

1. The time it takes Active4D to handle and dispatch a request.
2. The time it takes Active4D to return a response.
3. The time it takes for the database engine/application logic to handle
the response.

Active4D (with 4D's Web Server or NTK) can handle 1 and 2 well.

Clayton points out a good example where 3 may take a long time.

When using Active4D I like to let the code in my Active4D pages do as
much of the work as possible. We need to keep our site up 24/7 if
possible. Recompiling and publishing a new structure whenever we need to
make "web changes" prevents that. Keeping all of the changes in A4D
allows quick site changes.  The exception would be this case.

On Web Connection and/or OnWebAuthentication are not multi-threaded. But
4D (sort of) is. Active 4D can call 4D methods that can start new processes.

One solution might be to have Active4D handle the request, start a job
which runs a 4D process on the server (or another client), and
immediately return a response. That response contains a reference to the
process that is running on the backend. Your backend can track process
status in a table or an IP array at the back end. Your returned page
will wait a few seconds and send a simple "is my job done" request. The
back end will determine if the job is done. If it not it sends a simple
try later response. It it is done the results, or a reference to those
results, are returned. If you know that your processing will typically
take 10 - 20 seconds you can retry less often (less load on a4D). Your
retries can be done via a refresh in the page's HEAD or with Javascript
(AJAX). These days I'd use the latter.

So this is really a case of  not how many requests can A4D handle, but
what processing capacity can your 4D backend handle. Depending on your
expected load you might have a web "client" handling your web requests
and a pool of processing clients (or server processes) doing the heavy
lifting.

-- Brad Perkins


Donahue, Clayton L. wrote:

>> A typical web application does a query and shows some results. This
>>    
> typically takes a second or less.
>
> This is probably a bit of an oversimplification ... web applications are
> not simply front-ends for database management, or information browsers.
> Ideally, yes - there are some query parameters and a search is done. The
> recipe, picture, calendar, etc. is pulled and displayed. This of course
> requires that the data be readily available in its "display" form. Look
> at travel sites (Orbitz) - they throw up a five or ten second splash
> screen and limit your other requests while they are gathering
> information.
>
> I mention this because we are in a similar situation - a fairly small
> number web requests, each requiring an extensive amount of computation
> to provide a result. We *do* cache this end result, so that most of the
> time a single query will bring up the desired page. However, data is
> shifting and we cannot cache everything ahead of time. Thus, an
> un-cached request will come in and consume the server for 10-15 seconds.
> Not bad. However, when ten of these requests are suddenly fighting for
> resources within the same web process, this causes problems.
>
> In the end, the single 4D language thread is a bottleneck. You can
> definitely help out the situation: Using multiple RUNTIME instances was
> a good idea. So is using an Apache server as a reverse proxy to serve
> static pages. This takes some of the load off of 4D so that it can
> concentrate on "application" pages.
>
> - Clayton
>
> _______________________________________________
> Active4D-dev mailing list
> Active4D-dev@...
> http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
> Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/
>
>  

_______________________________________________
Active4D-dev mailing list
Active4D-dev@...
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

Re: Are "On WebConnection"and/or"OnWebAuthentication" multi-threaded?

by Steve Makohin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Clayton,

From: "Donahue, Clayton L." <CDonahue@...>

>> A typical web application does a query and shows some results. This
>> typically takes a second or less.
>
> This is probably a bit of an oversimplification ... web applications are
> not simply front-ends for database management, or information browsers.
> Ideally, yes - there are some query parameters and a search is done. The
> recipe, picture, calendar, etc. is pulled and displayed. This of course
> requires that the data be readily available in its "display" form. Look
> at travel sites (Orbitz) - they throw up a five or ten second splash
> screen and limit your other requests while they are gathering
> information.
>
> I mention this because we are in a similar situation - a fairly small
> number web requests, each requiring an extensive amount of computation
> to provide a result. We *do* cache this end result, so that most of the
> time a single query will bring up the desired page. However, data is
> shifting and we cannot cache everything ahead of time. Thus, an
> un-cached request will come in and consume the server for 10-15 seconds.
> Not bad. However, when ten of these requests are suddenly fighting for
> resources within the same web process, this causes problems.
>
> In the end, the single 4D language thread is a bottleneck. You can
> definitely help out the situation: Using multiple RUNTIME instances was
> a good idea. So is using an Apache server as a reverse proxy to serve
> static pages. This takes some of the load off of 4D so that it can
> concentrate on "application" pages.

I resonate with your response. From the start, I have been designing (and
building) my system with a highly scalable distributed-processing
architecture that lets me offload processor-intensive tasks to any number of
"client" workstations, which serve purely as background processors. Where
possible, a web user's request for compute-intensive work merely schedules a
"task", so the user gets what appears to be a very responsive system.
Meanwhile, the "client" workstations handle the various job queues.

Still, the downside here is that the 4D Processes (launched via 4D's New
Process command) running on any computer will *always* run on a single core,
rather than making use of multiple cores. 4D's weakness is the scalability
of the "business logic" layer (or "application" layer), when that layer is
NOT a client in a traditional client/server architecture.

-Steve Makohin
 Oakville, Ontario, Canada

_______________________________________________
Active4D-dev mailing list
Active4D-dev@...
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

Re: Are "On Web Connection" and/or "On WebAuthentication" multi-threaded?

by Steve Makohin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Mehoob,

From: "Mehboob Alam" <media4d@...>

>> I've done some tests that confirm processes started by 4D's New Process
>> command are not multi-threaded.
>
> I'm sorry that you had to go through the trouble to create tests and
> confirm this. It is public knowledge that the 4D language engine is
> single-threaded (cooperatively tasked), and this will not change in the
> future.

Don't be sorry. My work was not done to determine *if* this is the case, but
to determine how much it will impact me. "Proof of Concept" is often a good
idea,



> If you need to create a large scalable system, you can create multiple "4D
> RUNTIME" instances that communicate to a single "4D SERVER" via SQL, and
> get the maximum of your multi-core server.

That's what I've been doing, from Day-1. The design is also extremely robust
and resilient, with the ability to scale to "lots of" distributed-process
clients, and to automatically detect hung processes and to reassign them to
another distributed-process client. No surprises here.



> Keep in mind, the 4D Server license is priced accordingly, an additional
> license per core. You may want to price out your multi-core capable server
> license with 4D before you continue architecting your system.

According to 4D, the company, 4D Server v11 is licensed per client (2
standard, with optional expansion) when working in client/server mode, and
by core (2 standard, with optional expansion) when using the unlimited SQL
connection. My design is a combination of client/server and web, with no
need for the unlimited SQL connections.

-Steve Makohin
 Oakville, Ontario, Canada


_______________________________________________
Active4D-dev mailing list
Active4D-dev@...
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/