Support for DB2 databases?

Larry Menard
Larry Menard's picture

Joined: 2005-10-01
Posts: 757
Posted: Mon, 2006-02-20 17:44

I'm already looking at the code in both those files. What do you think I'm putting my debug code in?

I think I've finally figured out for myself what you guys mean by "cachemap", so now I think I'm back on track.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Mon, 2006-02-20 18:03

the one suspecious query is:

SELECT
	    AVG([RatingMap::rating]),
	    COUNT([RatingMap::rating])
		FROM
		[RatingMap]
		WHERE
		[RatingMap::itemId] = ?

i guess that DB2 AVG for a INTEGER column returns an INTEGER. that would explain why we get integer results from db2, i guess. but not sure, haven't looked too close.
can you experiment with the db2 avg function in an independent query, doesn't even have to be php related.

 
Larry Menard
Larry Menard's picture

Joined: 2005-10-01
Posts: 757
Posted: Mon, 2006-02-20 18:17

Yes, I just reached the same conclusion myself. Confirmed in the DB2 docs:

The data type of the result is the same as the data type of the argument values, except that: 

  - The result is a large integer if the argument values are small integers. 
  - The result is double-precision floating point if the argument values are single-precision floating point.

If the type of the result is integer, the fractional part of the average is lost.
 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Mon, 2006-02-20 18:29

arg. that calls for yet another UDF. :(
or do you have another idea?

maybe cast the value to double, something like

select avg(double(columnName)) from foo;

 
Larry Menard
Larry Menard's picture

Joined: 2005-10-01
Posts: 757
Posted: Mon, 2006-02-20 18:43

Yes, casting to double does seem to work.

	    query = '
	    SELECT
	    AVG(double([RatingMap::rating])),
	    COUNT([RatingMap::rating])
		FROM
		[RatingMap]
		WHERE
		[RatingMap::itemId] = ?
	    ...
	';
//	    AVG([RatingMap::rating]),

Does that mean an additional call to getFunctionSql()? Or will this work on other DBs?

Edit: fixing sample code snippet

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Mon, 2006-02-20 18:46

yes, that means another getFunctionSql call / case. i'll add it now, should be in tomorrows cvs version.

 
Larry Menard
Larry Menard's picture

Joined: 2005-10-01
Posts: 757
Posted: Mon, 2006-02-20 18:59

Thanks, Valiant.

That should leave only the failures:

ConfirmImportControllerTest.testImportno_NO
ConfirmImportControllerTest.testImportfr_FR
ConfirmImportControllerTest.testImportKOI_8
ConfirmImportControllerTest.testConvertHtmlToBbcode (runs clean in isolation, only fails if run with KOI_8)
IndexDotPhpTest.testHttpRedirect

All of which have been deemed non-fatal.

Last Friday Dan Scott volunteered to do a test installation on Linux. If I don't hear today how it went for him, I'll ask him tomorrow.

So what more will be required to make DB2 officially supported? :-)

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Mon, 2006-02-20 19:17

what more will be required? maybe the installer change to have a single field for DB2 in the db step instead of hostname + dbname.

i agree that we can remove the experimental from db2 in the db step.
first, please remove a inconsistency from the codex page. is it 8.2 or 8.2.2 that we require?

 
Larry Menard
Larry Menard's picture

Joined: 2005-10-01
Posts: 757
Posted: Mon, 2006-02-20 19:24

As much as I would like to lose the 'Experimental' flag, let's wait until we see how a Linux implementation goes before we do.

Yes I've been meaning to clarify that version requirement... I'm pretty sure that Dan originally told me 8.2.2 was required for 'ibm_db2', but then later he said 8.2. I'll clarifty it ASAP.

 
Larry Menard
Larry Menard's picture

Joined: 2005-10-01
Posts: 757
Posted: Mon, 2006-02-20 21:13

Valiant, we've clarified the DB2 version requirement. The required version of DB2 is 8.2 (also known as 8.1 FixPack 7).

 
Larry Menard
Larry Menard's picture

Joined: 2005-10-01
Posts: 757
Posted: Mon, 2006-02-20 23:38

Some thoughts regarding the Installer Step 5 changes for DB2...

Current requirement to put dbname in "Hostname" field:

Because of the parameter order difference between DB2 and other databases, we currently have to put the database name in the "Hostname" field. But there already is a "DB Name" field, so there's no need to make external changes to the page. I think that under the covers G2 should pass the args to the connect API in the right order for the database.

More flexibility for DB connections:

Since you have a Hostname field, I presume you want G2 to support connection to a database on remote systems.

DB2 does provide this ability in two ways, 'cataloged' and 'uncataloged'. 'Cataloged' means that the remote database particulars have been saved in a 'db alias' on the DB2 client, and that alias is used in the connection string. 'Uncataloged' means the remote database particulars are specified on the connection string, not stored in the DB2 client.

Here's some sample PHP code:

$driver = 'db2';
$server = 'localhost';
$user = 'lmenard';
$password = '........';
$database = 'sample';

if ($conn_type == 1)
{
  $db = ADONewConnection($driver);
  $db->Connect($server, $user, $password, $database);
}
if ($conn_type == 2)
{
  $dsn = "$driver://$user:$password@$server/$database";

  $db = ADONewConnection($dsn);
}
if ($conn_type == 3)
{
  $dsn = $driver . '://' . $user . ':' . $password . '@' . $server . '/' . $database . '?persist';

  $db = ADONewConnection($dsn);
}
// Connection type 4: Uncataloged connect string.
// See http://www.connectionstrings.com/ and the 'ibm_db2' db2_connect() doc
// (http://www.php.net/manual/en/function.db2-connect.php).
// I think this is an ODBC standard syntax, but I don't think ADOdb supports this,
// I don't even think PHP's ODBC API supports it, but 'ibm_db2' does.)
//
if ($conn_type == 4)
{
  $port = 50000;
  $uncatalogedDsn = 'DRIVER={IBM DB2 ODBC DRIVER};DATABASE=' . $database .
                    ';HOSTNAME=' . $server .
                    ';PORT=' . $port .
                    ';PROTOCOL=TCPIP' .
                    ';UID=' . $user .
                    ';PWD=' . $password;

  // Need to specify 2nd & 3rd args, even if empty.
  db2_connect($uncatalogedDsn, '', '');
}

Currently the DB2 support in G2 supports only 'cataloged' DB2 connections.

In order to support 'uncataloged' connections, we would need to ensure that all the required fields are on the Step 5 page. Currently, I believe all of them are there except Port Number.

If we could add an optional Port # field in some future release of G2, we could support uncataloged DB2 connections.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Mon, 2006-02-20 23:51

@port number: just use hostname:portnumber in the host name field. that's how it works for mysql, pg, ...
we won't add a dedicated port field for now since it works this way.

so all you request is that we either store the user input provided in the db setup request switched: hostname as db name and db name as host name.
or that our connect call in GalleryStorage::_getConnection switches the 2 arguments.

correct?

and why is that? isn't that an inconsistency in adodb that should be corrected, namely in your driver?

 
Larry Menard
Larry Menard's picture

Joined: 2005-10-01
Posts: 757
Posted: Tue, 2006-02-21 00:15

> isn't that an inconsistency in adodb that should be corrected, namely in your driver?

You're absolutely right. And even better, I already fixed it weeks ago. :-) It is no longer necessary to put the database name in the "Hostname" field, I've just been doing it out of habit. I'll upddate the doc on codex.

> just use hostname:portnumber in the host name field

OK, I'll look into that.

Thanks!

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Tue, 2006-02-21 09:16

so no need in the installer step "Database setup" is needed? cool :)
then i just wait to hear from Dan's unit test run. By the end of the week I'd like to remove the experimental warning, we have to give our translators a little time to translate the new DB2 description string. i'll do that whether or not Dan has run the tests by then i guess.

 
Larry Menard
Larry Menard's picture

Joined: 2005-10-01
Posts: 757
Posted: Tue, 2006-02-21 19:57

FYI, I did hear from Dan yesterday (he actually does monitor this thread). He did try the install but hit a couple of problems:

1) It was he that discovered the SQL_CUR_USE_DRIVER being accidentally left in the ADOdb driver. He got an error because his PHP build did not have ODBC support. This is why I *really* want to see people test this on Linux. :-) The more configurations we test on, the more bugs we'll shake out.

2) The build of DB2 he currently had was not recent enough to support the 'easy' creation of 32 K tablespaces (only available in fix pack 9 and up). As a result, I updated the doc on codex so that it includes instructions for others in this situation.

He said he'd try it again once he has a more current build of DB2.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Tue, 2006-02-21 21:25

ack and congrats as well as my condolences to your 500th forum post ;)

 
S Packowski

Joined: 2006-03-01
Posts: 1
Posted: Wed, 2006-03-01 22:38

Hi, all.

Way back on 2005-11-25, a problem with calling SQLJ_INSTALL was described thus by Larry Menard:

Quote:
FYI, I've hit a problem with running "CALL SQLJ_INSTALL(...)" from within PHP. I always get error:

Quote:
> PHP Warning: odbc_exec(): SQL error: [IBM][CLI Driver] CLI0119E
> Unexpected system failure. SQLSTATE=58004, SQL state 58004 in
> SQLExecDirect in C:\temp\CLI0119E.php on line 18

Dan Scott reproduced this problem with code that looked like this:

SQLCHAR *stmt1 = (SQLCHAR *)"CALL SQLJ.INSTALL_JAR('file:///home/dan/g2_db2.jar', 'g2db2')";
SQLCHAR *stmt2 = (SQLCHAR *)"CALL SQLJ.INSTALL_JAR('file:///home/dan/g2_db2.jar', 'g2db2', 1)";

(Both repro the problem.)

If you surround the CALL command with curly braces like this:

SQLCHAR *stmt1 = (SQLCHAR *)"{CALL SQLJ.INSTALL_JAR('file:///home/dan/g2_db2.jar', 'g2db2')}";
SQLCHAR *stmt2 = (SQLCHAR *)"{CALL SQLJ.INSTALL_JAR('file:///home/dan/g2_db2.jar', 'g2db2', 1)}";

then you don't get the error.

When the parameters inside a CALL statement are string literals, the ODBC escape clause delimeters {} must be used. Here is some documentation that describes this:
http://publib.boulder.ibm.com/infocenter/db2luw/v8/topic/com.ibm.db2.udb.doc/ad/t0007399.htm

As it happens, this issue has been raised as problematic by others recently too. APAR JR23175 has been opened to address this.

For information about APARs, you can go to the DB2 database support page:
http://www-306.ibm.com/software/data/db2/udb/support/
and search for the APAR for more information.

*Because JR23175 has just been opened, and is still being investigated, you won't be able to read the details yet. When this fix is released, then you will be able to see more.

I realize this answer comes long after you asked the question, but I hope it helps anyway.

Sarah Packowski

 
Larry Menard
Larry Menard's picture

Joined: 2005-10-01
Posts: 757
Posted: Thu, 2006-03-02 00:24

Ooh, very tricky.

Sarah, thanks very much for letting us know. I can see why others also stumble across this.

Valiant et al, I've incorporated and tested this fix, it works perfectly. I've updated the copy on http://cpe0013102da23b-cm0f0079804905.cpe.net.cable.rogers.com/misc/Gallery2/Db2Storage.class.txt... could you please review and checkin?

 
Larry Menard
Larry Menard's picture

Joined: 2005-10-01
Posts: 757
Posted: Thu, 2006-03-02 00:26

Oh, and I'll update the doc on codex ASAP.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Thu, 2006-03-02 05:43

so we're jumping back and forth, are we? :)

isn't the other argument still valid? "installing the jar during runtime requires too many permissions" which was raised by Dan as far as i can remember.

we can change it of course and remove the instructions on how to install it manually, but i'd like to get a clear "yes, that's what we really want" before.

 
Larry Menard
Larry Menard's picture

Joined: 2005-10-01
Posts: 757
Posted: Thu, 2006-03-02 14:36

No, we're not jumping back & forth. :-) We are simply moving to the right solution now that we know what it is.

The permissions issue raised by Dan was because at that time we wanted the server to execute the SQL using a Command Line Processor (CLP) command (via an exec() call). The "{...}" solution makes all of that unnecessary... it requires no special permissions for the web server, and is now processed just like any other normal SQL statement via the ADOdb/ibm_db2 layer... no exec().

Hope that explains it clearly.

Edit: Just making it even more clear.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Thu, 2006-03-02 22:39

ok, will do it tonight.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sat, 2006-03-04 05:14

style review:
- the indention in configureStore was off, should be 1 tab + 4 spaces (total 12 spaces)
- multiline comments should have /* on the first line and nothing else

DB2Storage changes are in cvs.
README changed appropriately (removed java jar instructions).

reported typo will be fixed after g2.1

 
Larry Menard
Larry Menard's picture

Joined: 2005-10-01
Posts: 757
Posted: Sun, 2006-03-05 15:00

I just noticed that the copy of "Db2Storage.class" I put on my server does not have the "{...}" fix on the REMOVE_JAR() call in the cleanStore() function. This is not critical, as it is probably not going to be executed that often, but it should still be fixed eventually.

Could you please change:

	 $statements[] = "CALL SQLJ.REMOVE_JAR('g2_db2_jar')";

to:

	 /* 
	  * De-register the Jar file (use ODBC delimiters, see 
	  *    http://gallery.menalto.com/node/37648?from=850#comment-172690) 
	  */
	 $statements[] = "{CALL SQLJ.REMOVE_JAR('g2_db2_jar')}";

And completely remove the comment:

	 /*
	 * These SQLJ.*_JAR() calls blow up, looks like CLI can't handle it
	 * $recordSet5 = $tmpDb->Execute("CALL SQLJ.REMOVE_JAR ('g2_db2_jar')");
	 */
 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Mon, 2006-03-06 01:49

in cvs.

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Tue, 2006-03-28 00:32

do we need the drivers/adodb-odbc.inc.php file anymore? i'm upgrading CVS to adodb 4.80 and i'll omit this file if we only use adodb-db2.inc.php now.

 
Larry Menard
Larry Menard's picture

Joined: 2005-10-01
Posts: 757
Posted: Tue, 2006-03-28 00:39

Good spotting. No, we no longer need it for DB2, and since it wasn't there before DB2, therefore it should be safe to remove it.

 
73blazer
73blazer's picture

Joined: 2006-05-12
Posts: 79
Posted: Fri, 2006-05-12 03:04

Just FYI, i managed to get G2 working with DB2 on my AIX machine. Thought you'd be interested to know (considering the post a couple months ago of nobodys using db2 yet :).

Just a couple of questions, if you'll so indulge me:
Why does it need the 32k bufferpool? I wanted to use my existing wwwdb database, so I made a bufferpool and tablespace for g2 (as according to this), the problem with the installer there is the user you specify does not make his tables in the new tablespace, they get dumped to USERSPACE1, because none of the tables are requireing the larger pagesize. Yes I created the tablespace with that user. Anyhow, just to ensure the new tables were created in the 32k tablespace, i edited lib/adodb/drivers/adodb-db2.inc.php and added
if (strtoupper(substr($sql,0,12))=="CREATE TABLE") $sql.=" IN G2";
in the top of the function _query (G2)
Perhaps asking the user for the tablespace might be a future enhancment for DB2?

Anyhow...all seems to be working, however, I'm so not impressed with the performance. I've only had it working now for a couple of hours, I've imported some of my albums from G1, I think it's actually slower and G1. I regenerated the thumbs and resized images, still very slow. Every pick is a painful 2-3 second wait, and i'm browsing directly on the server! I even tried browsing from my windows machine directly on the same network hub, just to remove the mozilla runtime from the duties of the server, and same slowness.
Mabey I did something wrong...dunno...

I'm not critizing here, but why use the IBM_DB2 driver? I havn't looked if g2 is storing blob,clob etc, but the only thing I saw when I looked into ibm_db2 a while back was that it could do more easily BLOB,CLOB, etc. I've written several php apps with just the odbc driver and they are very speedy. The IBM_DB2 thing seems much more than was needed, for my uses anyhow.
Certain things are faster, like loading the one album i have with almost 1000 images, but not by much. I was hoping the DB version of gallery would stop the painful waits I had on large albums.

I could be missing something basic with g2 itself here though...so..i'm still playing..

feel free to browse yourself my g1 or my g2

Installtion specs:
Machine: RS/6000 44p270 5gb RAM 4way-375mhz power3 processors
Software: Apache 2.0.43, PHP 5.1.4 w/IBM_DB2 and ibm-db2 compiled with qarch qtune qsmp DB28.1 FP11 (same as 8.2FP4)
Application: Gallery 2.1.1a

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Fri, 2006-05-12 03:28

> Why does it need the 32k bufferpool?

because we needed a equivalent to mysql/postgres colunm types which allow us to store up to 32kbyte of character data (long texts like descriptions).
don't remember if the db-based page cache of g2 is also limited by that.

> slowness

could be db2 related, could be g2. have you tried mysql? could be g2 / AIX, since we don't have many AIX or DB2 users i don't have enough data points to judge the situation. also note that weird slowness was also observed for g2 / windows on some servers. there was never a user that actually profiled such slowness to find out what actually caused it.

> ibm_db2 driver

it's recommended by the IBM guys and superior to the odbc one in php. and it has less bugs that matter for us.
and yes, we use blob for compressed html page level caching in the db.

already using eaccelerator? if not, you should. and are you using g2's page level caching? site admin -> performance.

 
Larry Menard
Larry Menard's picture

Joined: 2005-10-01
Posts: 757
Posted: Fri, 2006-05-12 04:05

Hi, 73blazer.

Thanks for the feedback, I do appreciate it.

Valiant has answered most of your points pretty well.

As for the performance issue, unfortunately I don't have a dedicated system on which I can do reliable performance tests. I don't notice any performance problems on my Windows system. The only things I might add to Valiant's comments are:

1) Advanced Performance monitoring in DB2 is not for the faint of heart, but you might want to make sure you've done at least rudimentary performance tuning of the database (i.e., making sure the Optimizer's statistics are current, using 'runstats' or 'reorgchk'). Without up-to-date statistics, DB2's Optimizer can make bad choices of access plans.

2) If you manually created the tablespaces and bufferpool as described in the doc on codex, then you are running with a bufferpool of 250 pages. That figure was a rough approximation of what I figured you might need. It's possible that it might not be sufficient. You can try increasing it to see what happens, or use the DB2 Monitor to see if you should increase it. Or it might be that you are a victim of repeated activation/deactivation of the database (and therefore allocation/deallocation of the bufferpool and various heaps). Try issuing a "ACTIVATE DATABASE" command on the database and see if that helps any. If it does help, then you may want to put that command in a startup script somewhere on your system so the database stays activated even when there are no active connections.

3) G2 actually uses a combination of VARCHAR() and CLOB. We would have liked to have used all CLOB instead of VARCHAR, but there are some restrictions in the kinds of WHERE clauses DB2 supports against CLOBs.

I'll look into your suggestion regarding explicitly specifying tablespaces in the CREATE TABLE statements, that's a very good point.

I hope this helps.

 
73blazer
73blazer's picture

Joined: 2006-05-12
Posts: 79
Posted: Fri, 2006-05-12 05:17

Hey, wow, quick responses here!

Um...never heard of eaccelerator..but found it and that looks really nice. I'll be giving that a try in the next few days.

I did have the page-cacheing thing turned on. And I ran the optimizer thing.

Monitor says i'm ok on the bufferpool.

The activate database thing very well might be doing it. Only apps I have using db2 here are mine, and I leave the conn open until the end of the script. From looking at some low-level monitoring, it's getting open/closed/open/closed many times during a single page execution of g2. It's importing my largest (3000+ pics) album right now from g1..I don't want to disturb it, but I'll be trying that. I did a re-org and runstat just after installation.
I've run that performance monitor a few times in the past for problems, what a bear, but very nice job it does in the end. Mabey I'll get into that.
If this works, I can migrate a customer of mine (30000+ images) and they'll be very happy.
Thanks for all the help..i'll keep you posted.

 
73blazer
73blazer's picture

Joined: 2006-05-12
Posts: 79
Posted: Fri, 2006-05-12 13:05

During G1-G2 imports I get this message at the end of the import if the source gallery had any movies in it.
Then is says no alubums or items imported, but they all were, even the movies. Imports all look fine.

I also notice that after importing a couple large albums, free memory has gone from 3gb to 0 (even after apache restart), and i'm paging, DB2 does not like paging. So after the imports, i'll reboot, mabey it'll get faster.

Just FYI

Error (ERROR_STORAGE_FAILURE)

* in modules/core/classes/GalleryStorage.class at line 610 (GalleryCoreApi::error)
* in modules/core/classes/GalleryCoreApi.class at line 2881 (GalleryStorage::updateMapEntry)
* in modules/core/classes/GallerySession.class at line 396 (GalleryCoreApi::updateMapEntry)
* in main.php at line 93 (GallerySession::save)
* in main.php at line 80

System Information
Gallery version 2.1.1
PHP version 5.1.4 apache2handler
Webserver Apache
Database db2 DB21085I Instance "db232cli" uses "32" bits and DB2 code release "SQL08024" with level identifier "03050106". Informational tokens are "DB2 v8.1.1.104", "s060120", "U805924", and FixPak "11". Product is installed at "/usr/opt/db2_08_01".
Toolkits ImageMagick
Operating system AIX blazer 3 5 0003739F4C00
Browser Mozilla/5.0 (X11; U; AIX 5.3; en-US; rv:1.7.12) Gecko/20051025

 
73blazer
73blazer's picture

Joined: 2006-05-12
Posts: 79
Posted: Sat, 2006-05-13 16:24

Well..i think the DB2 driver is OK. There's a few areas producing DB2 errors, anyhow...i've been playing with G2 all day, and I just can't seem to get it to perform better than G1. Using DB2 monitor, it was paging out the bufferpool, so I increased to 1000 pages. That helped, the Activate databased help...but still not so good. I've got some other pretty heavy enterprise apps running on db2 here, none of them work DB2 as hard as G2 does here, so I'm just not sure where the problem lies. If the page isn't cache, it's a painful 5-8second wait while I see db2sysc process to the top of the cpu list and my 4 cpus are about 25% busy each. I've got tables for a PDM with over a million entries with 103 attributes, couple of clobs in there, and i see nary a blip on my cpus when a query is run.

FYI, for the pagecache option, i kept getting SQL0102 (statment too long) whenever that was turned on in the performance tab. I had to increase my databases stmtheap from the default of 4096 to 6144.
--> db2 update db cfg for wwwdb using STMTHEAP 6144

pagecache definatly makes performance much better..but without it the db still seems to be overworked. Mabey if I have more time in a couple weeks, I can attempt to turn on some monitors to see what exactly is going on.

 
Larry Menard
Larry Menard's picture

Joined: 2005-10-01
Posts: 757
Posted: Sat, 2006-05-13 18:03

> If the page isn't cache, it's a painful 5-8second wait while I see db2sysc process to the top of the cpu list and my 4 cpus are about 25% busy each

Ouch, that does sound painful. I haven't seen anything like that on my Windows system or Linux VMWare image.

> I've got tables for a PDM with

Sorry if this is a dumb question, but... what's PDM?

> for the pagecache option, i kept getting SQL0102 (statment too long) whenever that was turned on in the performance tab

Sorry if this is an even dumber question, but I'm not sure what you mean here. What "pagecache" option? What "performance" tab?

> pagecache definatly makes performance much better

How much better? Is it now what you would expect?

> I did a re-org and runstat just after installation

The time to do a runstats is after you populate all the tables. There's no value in generating statistics like cardinality when your tables are empty. If that's the case then I wouldn't be at all surprised if DB2's Optimizer is generating access plans that use very inefficient table scans instead of indexes. (Shudder...)

 
73blazer
73blazer's picture

Joined: 2006-05-12
Posts: 79
Posted: Sat, 2006-05-13 18:55

PDM=Product data managment (My job is to write add-ons for enterpise PDM system..sorry..i sometime forget that 99% of the world probably has no idea what I'm talking about with PDM's :) )

The pagecache option...under site-admin -> left menu performance -> set them to full acceleration. This is what causes entries into cachemap table, which was exceeding the limits of stmtheap parameter. cachemap table appears to store the raw html of a page, it's looked at first, if an entry is found for that page, it uses the page that was inserted into that table instead of generating a new page. It's cheating though because it's essentially a cache, while performance there is great, it appears that there's a bit more work on that function I think because if your logged in, the cached paged might try to save that login state, then a normal user hits the page and it re-generates anyway, or when you go back to another cached page as a logged in user, it now shows you as logged out, but your really logged in, hit the login link and it gives a blank page, probably getting confused that your really already logged in.

Anyhow..i did re-org & runstats after i imported everything.
It's just really really slow. If I got a page with 40 thumbs, it takes 2-4 seconds to load the page, the another 4-8 seconds as it retrieves each thumb.(remember I'm sitting on the server running mozilla.. no network bandwidth problems) I can watch each row of thumbs come as the page is being displayed, and the CPU's are 25% busy.
I know it's not my machine either, this machine is an mid-range enterprise server. The reason I mention the PDM's, i can show a whole automobile tree, every single part, nut, bolt fastener, with configuration filters (car options like sunroof,radio type,engine,trans..etc), many hundreds of db queries from 100's of tables, most of which have 30-50 attributes, some over 100, i see my cpu's blip up to 30-40% for a few seconds, and the whole car is shown. So to show 40 thumbs, should take just milliseconds, not seconds.
Somethings not right. I'm leaning towards some db2 tuning issue..but I'm not sure. I'm no tuning expert so I'll have to muttle through it. performance is still quite unaccectable.
So I think more investigation is needed here...

 
Larry Menard
Larry Menard's picture

Joined: 2005-10-01
Posts: 757
Posted: Sat, 2006-05-13 20:06

> The pagecache option...under site-admin -> left menu performance -> set them to full acceleration.

Ah, I don't have that option on my DB2-based Gallery. The build of Gallery that I'm running on my Production server is a development build from before 2.1 was finalized. I keep meaning to do the upgrade to the official 2.1 build, just haven't gotten to it yet. Sounds like this Performance tab is something that was added after I got DB2 working, but I didn't know about it so I didn't test it.

I'll prioritize upgrading my server so I'm the same as our Users.

> I'm leaning towards some db2 tuning issue

I tend to agree. If you're already familiar with DB2 Monitor then I won't bother describing it to you. I'd suggest that a good place to start is just taking a database snapshot:

"db2 update dbm cfg using dft_mon_bufpool on on dft_mon_lock on dft_mon_sort on dft_mon_stmt on"
"db2stop", "db2start"
"db2 connect to wwwdb"
"db2 get snapshot for database on wwwdb"

 
irishboy

Joined: 2006-05-17
Posts: 1
Posted: Wed, 2006-05-17 19:26

Hello,

I'm trying to discover if I've done the install of ibm_db2 correctly. I installed it quite some time ago, and have since upgraded to DB2 8.2 (FP11). The PHPINFO page says it was compiled '--with-ibm-db2=/home/db2inst1/sqllib' but in reading on this site and others, I understand that : "To build the ibm_db2 extension, the DB2 application development header files and libraries must be installed on your system."

How can I tell if this step has been done? I have ESE running on the box, but the client install (when I try through ./db2setp) fails with an earlier version message.

If I could just find out what directory, and what headers/libraries I need, I can query the system and find out.

Thanks in advance for any help.

Oh- also, is Dan Scott still around? I got some wonderful help from him when I did the install.

 
Larry Menard
Larry Menard's picture

Joined: 2005-10-01
Posts: 757
Posted: Wed, 2006-05-17 19:56

Hi, Irishboy. I think I remember you from some DB2 newsgroup discussions.

The "DB2 application development header files and libraries" are sometimes referered to as the "Application Development Client". It is included with the Enterprise Server Edition (ESE), so if you have that installed then you most likely do have the AD Client (unless you opted not to install the AD Client during the ESE installation).

A quick way to check is to look for "include" and "lib" directories under your sqllib. If they are there and contain anything at all, then the AD Client appears to exist. If you were able to successfully build the 'ibm_db2' extension then it's also a pretty safe bet that it is there.

The 'earlier version' message you mention sounds worrisome though... I would suggest getting that properly resolved first. Try the DB2 UDB newsgroups on server 'news.software.ibm.com'.

Dan Scott is still around, though he is no longer with IBM. When I did the port of DB2 support in Gallery2 and ADOdb he did hang out here, but I don't know if he still does. The 'ibm_db2' extension is formally supported via their web site at http://pecl.php.net/package/ibm_db2. Again, I don't know if Dan hangs out there still or not.

 
73blazer
73blazer's picture

Joined: 2006-05-12
Posts: 79
Posted: Wed, 2006-05-17 20:16

Be careful. ibm-db2 is different than ibm_db2, or rather IBM_DB2. I built both into my PHP. Initially I just had ibm-db2 which just links db2 with php at compile time so the odbc driver can work. the IBM_DB2 driver is very different.
This was my configure line:

Quote:
./configure' '--prefix=/opt/freeware' '--with-IBM_DB2=/usr/opt/db2_08_01' '--with-config-file-path=/apache/conf' '--with-gettext=/opt/freeware/bin' '--with-ibm-db2=/db232cli/sqllib' '--enable-shared' '--with-apxs2=/apache/bin/apxs

As Larry mentions, it's a PHP extenstion, there's instructions for how to install the extension in the link he provided, or check php.net site for installing PECL extension which is where the ibm_db2 extension page links to anyway i think. IIRC, there's 2 ways, the add-a-extension way, and the build it into PHP at compile time (which I did, because the add-a-extenstion way didn't work for me on my AIX machine).

Anyway..just FYI ibm-db2 is just the odbc driver and not the ibm_db2 extension. You'll notice at compile time ibm-db2 takes the instance sqllib as it's input and IBM_DB2 takes the DB2 unload directory as it's input.

 
Larry Menard
Larry Menard's picture

Joined: 2005-10-01
Posts: 757
Posted: Wed, 2006-05-17 20:26

> ibm-db2 is different than ibm_db2, or rather IBM_DB2

Good catch, I missed that. :-) Thanks.

 
73blazer
73blazer's picture

Joined: 2006-05-12
Posts: 79
Posted: Sun, 2006-05-21 18:36

Alright. Mabey you can make more sense of these than me. I'm no DB2 expert here...with monitor I've usally only run with help from a DBA for a guy on phone from the toronto lab.
I don't really see anything wrong...aside from the slowness.
I ran a loop then executed some g2 pick(s) then stopped the loop. They are all separated by =================================== Next Second (even though there 4-5 per second). The first and last couple are probably nothing as I was moving my mouse back to te window to start or stop the thing.

http://snyderworld.org/ftp/g2mon

 
Larry Menard
Larry Menard's picture

Joined: 2005-10-01
Posts: 757
Posted: Sun, 2006-05-21 20:08

Most of the useful metrics are cumulative, so the impact of the first & last snapshots is minimal. In fact, taking 3 or 4 snapshots per second is probably excessive... only 1 snapshot at the end of the test session would have been sufficient. :-)

In your snapshots, at first glance I see nothing alarming either.

First snapshot timestamp: 09:43:44.437896
Last snapshot timestamp: 09:56:01.324095
Total monitor duration: About 13 minutes.

- Number of SQL statements processed: about 4,000
- There are no lock waits at all
- No LSN Gap Cleaner or Dirty Page cleaners
- There are 166 sorts, for a total of 1.877 seconds
- Ratio of bufferpool data Logical reads to Physical reads: about 200:1
- Ratio of bufferpool index Logical reads to Physical reads: about 300:1
- Total bufferpool read time: 341 milliseconds
- Direct Reads elapsed time: 1 milliseconds
- Ratio of Rows Read to Rows Selected: a little over 100:1
- Log read and write time: 8 nanoseconds
- Ratio of Package Cache Inserts to Lookups: about 5:1
- Ratio of Application Section Inserts to Lookups: about 2.5:1
- Hash Joins: 158
- All memory heaps have lots of space.

I'll have to look up some of these metrics in the DB2 doc to make sure they're reasonable. It's sometimes tough to judge without a comparable set of metrics from a well-performing system, but at first glance I think this puppy should be flying. I'll let you know when I've confirmed it in my own mind (might take me a few days... will be kinda busy for the next 3 days).

 
73blazer
73blazer's picture

Joined: 2006-05-12
Posts: 79
Posted: Sun, 2006-05-21 22:29

No rush here. I was gone all last week! I just tappreciate the help. Thanks.
I might try and look up a few things on DB2 performance people taught me in the past and see if those tell me anything.

 
sphericus

Joined: 2005-11-06
Posts: 55
Posted: Mon, 2006-05-29 05:39

I had a quick look over the previous posts, and I could not determine if you guys were able to get G2 tested on Linux/x86 yet?
If you haven't are you still looking for one? As I just had an oppotunity to install php on my linux box and I got G2 up now as well. If you want some data just let me know.

Regards,
Sphericus

 
Larry Menard
Larry Menard's picture

Joined: 2005-10-01
Posts: 757
Posted: Mon, 2006-05-29 08:02

Hi, Sphericus.

I did successfully test G2 on a Linux (SLES9) VMWare image that IBM provides, but the more testing done, the better. So if you have the time to do at least a quick install & sanity test on your physical Linux box, I'd appreciate it.

Thanks.

 
sphericus

Joined: 2005-11-06
Posts: 55
Posted: Mon, 2006-05-29 10:51

Hi,
I have installed, it and loaded it up with some pictures. I did some stress testing of it, and with the tool I had, I simulated 200 people with 2 connected streams going for 1 minute, it seemed fine.

If you have anything you want me to test in particular please let me know. From what I can tell it seems fine.

Forgot to add this is SLES 9 too, on x86

System Information
Gallery version 2.2-svn
PHP version 5.0.4 apache2handler
Webserver IBM_HTTP_Server/6.0.2 Apache/2.0.47 (Unix) PHP/5.0.4
Database db2 DB21085I Instance "db2inst1" uses "32" bits and DB2 code release "SQL08020" with level identifier "03010106". Informational tokens are "DB2 v8.1.0.64", "s040812", "MI00086", and FixPak "7". Product is installed at "/opt/IBM/db2/V8.1".
Toolkits SquareThumb, NetPBM
Operating system Linux anacreon 2.6.5-7.97-default #1 Fri Jul 2 14:21:59 UTC 2004 i686
 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Mon, 2006-05-29 10:55

run the unit tests :)

http://127.0.0.1/gallery2/lib/tools/phpunit/index.php
click on the filter input field and hit enter

which is the same as
http://127.0.0.1/gallery2/lib/tools/phpunit/index.php?filter=

which will run unit tests for all installed modules.

therefore, first activate all g2 modules.

 
sphericus

Joined: 2005-11-06
Posts: 55
Posted: Mon, 2006-05-29 10:57

I did a multi-site install.

it says

Security Check
You are attempting to access a secure section of this Gallery installation. You can't proceed until you pass the security check.
You must create a config.php file in the Gallery directory before you can continue configuring the application. Use the installer to create one.

What is the best way around the problem?

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Mon, 2006-05-29 11:00

run the unit tests in your codebase installation, not in the multisite.

 
sphericus

Joined: 2005-11-06
Posts: 55
Posted: Mon, 2006-05-29 11:02

Is that the one where the installer was run from? If so, that is the site that I used. As the multi-site gave me a 404 for the url you gave me.