New topic: 

Databases...when to load.

<http://forums.realsoftware.com/viewtopic.php?t=46738>

         Page 1 of 1
   [ 7 posts ]                 Previous topic | Next topic          Author  
Message        JohnV          Post subject: Databases...when to load.Posted: 
Mon Jan 28, 2013 5:04 pm                         
Joined: Sun Jan 28, 2007 2:38 pm
Posts: 158                Our web app connects to 5 separate mySQL databases.

As a matter of course: actually just because we started out with one database 
and we kept with the same scheme:  we connect to all 5 databases in 
session.open.  (It worked fine for the first DB and over the months we just 
connected the rest with little or no thought in the matter)

I was wondering how heavy the overhead is here. One of the databases is rarely 
used by the app and is only used thru a single point of entry.  (The same page 
every time).  I am trying to determine if there is any heavy overhead of having 
the database loaded/ any advantage of moving the load point of the database to 
"just in time".

My gut tells me that the DB is just a connection and weighs nothing.  Thus; 
reducing the simplicity of simply loading all the databases up front is not 
worth sacrificing.

Comments?   
                             Top                timhare          Post subject: 
Re: Databases...when to load.Posted: Mon Jan 28, 2013 5:13 pm                   
      
Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12034
Location: Portland, OR  USA                There will be a limit to the number 
of simultaneous connections the database allows.  If that isn't an issue then 
no problem.  On the other hand, most web interaction with mysql databases are 
in short, discrete bursts - connect, query, disconnect - so the db is optimized 
in that direction.   
                             Top                Bob Keeney          Post 
subject: Re: Databases...when to load.Posted: Mon Jan 28, 2013 8:47 pm          
                       
Joined: Fri Sep 30, 2005 11:48 am
Posts: 3406
Location: Lenexa, KS                But because it's all going through one 
(MySQL) plugin won't it all just be considered one connection?  Even though 
each Session is in its own thread I thought the plugin was in the main thread 
thus meaning there was no separate connection.

Honestly, I've not played with this but I thought that's way it worked.      
_________________
Bob K.

Real Word Processing for your Real Studio Applications with Formatted Text 
Control
http://www.bkeeney.com/formatted-text-control/  
                             Top                timhare          Post subject: 
Re: Databases...when to load.Posted: Mon Jan 28, 2013 9:00 pm                   
      
Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12034
Location: Portland, OR  USA                Each session should have its own 
database object and its own connection (which he is doing).   
                             Top                JohnV          Post subject: 
Re: Databases...when to load.Posted: Mon Jan 28, 2013 10:22 pm                  
       
Joined: Sun Jan 28, 2007 2:38 pm
Posts: 158                Each session has a database object for each database. 
  
                             Top                Sky Stream          Post 
subject: Re: Databases...when to load.Posted: Mon Jan 28, 2013 10:34 pm         
                
Joined: Sun Nov 23, 2008 12:27 am
Posts: 382
Location: New Jersey                are all the databases on the same server or 
separate physical servers?

part of my thinking is (and I am thinking how I would do it with ms sql) is let 
the database do all the connections in the background and your app connects to 
the main db.

if its on the same server.. you can run queries, updates, inserts, etc.. and 
call each database as database1.dbo.table or database2.dbo.table

or if they are on seperate servers.. are linked servers a possibility?      
_________________
- Rich  
                             Top                taylor-design          Post 
subject: Re: Databases...when to load.Posted: Mon Jan 28, 2013 11:13 pm         
                
Joined: Wed Mar 22, 2006 11:15 am
Posts: 538
Location: Southern California                Just ran some tests using Real 
Studio 2012r2.1 on a MacBook Pro.

Time to open a MySQL connection:
On the same machine: roughly 10,000 microseconds (0.01 seconds)
On a cohosted server (100 Mbps at cohost / 45 Mbps at home): roughly 50,000 
microseconds (0.05 seconds)

That's long enough that I would want to keep open connections for the session 
as opposed to opening/closing with each query. But not long enough to worry 
about opening 5 for a new session, with the caveat that a high traffic site 
with high session turnover could stress this.

Obviously it's best if your database server(s) are on the same network. But 
even remote servers will work fine, as far as opening new connections is 
concerned, if the Internet connection at both ends is decent.      
_________________
Daniel L. Taylor
Custom Controls for Real Studio WE!
Visit: http://www.webcustomcontrols.com/  
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 7 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to