Tuesday, 2009-02-24

*** clach04 has quit IRC00:40
*** rossand has quit IRC01:25
*** perftuning has quit IRC01:53
*** troal011 has joined #ingres02:05
*** troal01 has quit IRC02:22
*** rossand has joined #ingres03:00
*** ChanServ sets mode: +o rossand03:00
*** rossand has quit IRC04:43
*** Alex|off is now known as Alex|06:54
*** troal011 has quit IRC07:36
*** Alex| is now known as Alex|off07:58
*** Alex|off is now known as Alex|07:59
*** troal01 has joined #ingres08:05
*** grantc_offline is now known as grantc08:27
*** crogr01 has joined #ingres08:30
*** withdefault has joined #ingres08:31
*** mib_5tyfuu has joined #ingres08:32
*** mib_5tyfuu has left #ingres08:32
*** crogr01 has quit IRC08:32
*** ChanServ sets mode: +o withdefault08:34
*** crogr01 has joined #ingres09:19
*** crogr01 has left #ingres09:19
*** crogr01 has joined #ingres09:23
*** crogr01 has left #ingres09:23
*** crogr01 has joined #ingres09:26
*** crogr01 has left #ingres09:26
*** grantc has quit IRC09:29
*** grantc has joined #ingres09:30
*** ChanServ sets mode: +o grantc09:30
*** crogr01 has joined #ingres09:48
*** crogr01 has left #ingres09:48
SlimeyPetegrantc: we're beginning our testing for migration to PHP5, and we've noticed that our memory usage has shot up considerably. I can't be 100% sure yet but I think that retrievals from Ingres are using considerably more memory than they sued to. Is this a known phenomenon?10:48
SlimeyPete... or have we just managed to mis-configure things somehow ...10:48
grantcSlimeyPete, perhaps10:49
* SlimeyPete is having some trouble figuring out exactly where the problem lies because our PHP4 setup doesn't have memory_get_usage() compiled in >.<10:49
grantcthe driver allocates memory for a fetch of 100 rows10:49
grantcdepending on the row width it may or may not fill that buffer10:50
grantci can add a config parameter to configure the number of rows it buffers10:51
grantcor tries to buffer10:51
SlimeyPeteHmm. In this case we're fetching more than 100 rows; it's more like 1000+, all in one hit (I think my boss' wrapper function uses the fetch_all function)10:51
SlimeyPeteand later on in the script I'm looking at we're fetching perhaps 10-100k rows depending on the user's parameters (it's a web-based report)10:52
grantcsure but what happened before in the driver it would allocate the memory for a single row, fetch that row, free row and repeat for each row10:52
grantcnow the driver tries to batch fetch 100 rows at a time to reduce the comms traffic10:52
SlimeyPeteAh. Now it allocates for 100, fetches 100, rinse & repeat?10:52
grantcyup10:53
grantcthere is no logic there to adjust for the row width10:53
SlimeyPetething is, the difference in memory usage is in megabytes10:54
grantconce you have finished with the resultset you can call ingres_free_result() and it will release10:54
SlimeyPeteat least, that's my best guess, not having access to memory_get_usage on our PHP4 system10:54
grantcthe only place memory allocation has ballooned up, afaicr is from 2.0.0 to 2.0.110:54
SlimeyPeteHmmm.10:57
SlimeyPeteOnce it's fetched its 100 rows, I take it it then frees the buffer? So the maximum overhead at any one time should be 100 rows-worth of memory, if we were fetching the smallest possible rows.10:58
grantcthe driver does not leak, at least from what i have seen from valgrind10:58
grantcyes something like that ...10:58
SlimeyPeteThanks for the info. I think I'll dig a bit deeper into my boss' wrapper function and see if I can pinpoint the problem a bit better.11:00
grantcif you want a patch to reduce/increase the number of rows let me know11:00
grantcAlex|, same goes for you11:01
grantchttp://ingres.pastebin.com/m6e1329c8 - needs to be applied against CVS HEAD revs11:04
SlimeyPeteHmm. Retrieving 3113 rows into an array using ingres_fetch_array in a while-loop uses 5.79MB of memory, which is 2KB per row.11:17
grantchow big is the row in Ingres?11:17
SlimeyPeteyou mean the maximum row size we have configured, or the size of the data that the query actually returns?11:18
grantcthe latter11:18
SlimeyPeteI don't know how to find out, tbh11:18
SlimeyPetethough I can have a pretty decent guess, actually, cos I know the column widths... hang on11:19
grantcalso how are you referencing the data in the array, by number or col name?11:20
SlimeyPeteI think we use both, in the same array (there's some ancient code in some of the pages which still relies on column numbers)11:21
SlimeyPeteright, my matchbook calculation suggests an upper limit of 40 bytes worth of actual data per row (we're only retrieving a few columns at this point and they're a mixture of c[2-8] and i4)11:22
grantchmm11:22
grantchow many queries are you issuing in a request?11:23
*** withdefault has quit IRC11:23
SlimeyPeteOne. The connection is opened, a single query (which may use a UNION, as in this case) is fired off, then ingres_commit() is called and the connection is closed.11:24
grantchmm11:24
grantcI guess i need to have a closer look at this11:25
grantccan you file a bug11:25
SlimeyPeteOkay. Could you remind me how to find out what version of the driver we're using please?11:25
grantchttp://pecl.php.net/bugs/report.php?package=ingres11:25
SlimeyPeteis it in phpinfo? (I can't see it)11:25
grantcecho INGRES_EXT_VERSION11:25
SlimeyPeteah, cheers11:26
grantcit should be in phpinfo as well11:26
grantcnext to "Ingres Extension Version"11:26
SlimeyPetehmm, looks like we're running v2.0.011:29
SlimeyPetemight it be worth upgrading first?11:29
grantcfor sure - things will be quicker under 2.0.2 or current cvs head11:30
SlimeyPetealso, a thought occurs: our page size on the DBMS is 2KB. Is it possible that Ingres itself is sending the rows padded to a full page?11:32
* SlimeyPete is not DBA-trained so is on shaky ground here ;)11:33
SlimeyPeteit is a flippin' ancient version of Ingres11:33
grantcwithout debugging the code on your ingres installation/version i could not say but i would say it is unlikely11:34
SlimeyPeteright... well I'll ask our SAs to upgrade the driver, and then if things are still broken I'll file a bug11:36
grantcwith php 4 did you use the 2.0 driver or the built-in one?11:37
SlimeyPetethe built-in one, I think11:38
grantchmm11:38
SlimeyPeteyes, I remember that it's a 1.x version11:38
grantcnot built-in but based on the same code (more or less)11:38
grantc2.0 is was a massive change...11:38
grantcin fact for your use case - connect/select/fetch/close there should not be that much difference.11:39
grantcexcept the driver fetches via a cursor now (for selects)11:40
grantci have on my list, as mentioned before ingres_unbufferred_query() which will be have as before11:40
grantcbehave even..11:40
SlimeyPeteis there any easy way to intercept & log the exact data that Ingres is sending across the network when the openapi call is made?12:01
* SlimeyPete guesses probably not12:02
grantcdefine easy12:02
grantcdefine II_API_TRACE=5 II_GCA_TRACE=5 II_API_LOG=/tmp/some.log12:03
SlimeyPete"could be achieved within an hour or so"12:03
grantcsetting those variables and running the php via the shell will be easier, via the web server you need to jump through some additional hoops12:03
SlimeyPetehmm... I could have a crack at that after lunch12:04
SlimeyPeteI'm just curious as to what Ingres is actually doing when I run this stuff12:04
*** MagnusG| has joined #ingres12:33
pboroHi MagnusG|12:34
MagnusG|Hi pboro12:34
pborohmmh12:53
pboroCaused by: com.ingres.gcf.util.SqlEx: Cannot INSERT into table '"opsi_opetusohjelma_otsikot"' because the values do not match those in table '"opsi_opetusohjelmat"' (violation of REFERENTIAL constraint '"$opsi__r000005f600000000"').12:53
pborothe funny thing is, that iiconstraints table does contain "$opsi__r000005f600000000", but it for different table than the one mentioned in the error message12:53
pboroahh... figured it out12:55
*** rossand has joined #ingres13:24
*** ChanServ sets mode: +o rossand13:24
*** DarylM has joined #ingres14:49
* SlimeyPete notes that the OpenAPI log is making his eyes spin :D15:07
grantcSlimeyPete, ha-ha :)15:07
SlimeyPeteas far as I can see, Ingres is sending through the data in a perfectly reasonable form, so I guess I can rule out a problem with the DBMS.15:08
SlimeyPeteright, time to poke our SAs and get 'em to upgrade the driver :)15:09
grantcit could be a difference in PHP15:09
grantcit's now recommended that memory_limit is set to 128 or 25615:10
SlimeyPeteour PHP version's actually newer than your bug report form will accept :D15:10
grantcNOTB then :)15:10
SlimeyPeteyeah, the last resort is to just up the limit15:10
SlimeyPetebut I'd still be concerned that our script is taking up so much more memory15:11
grantconce you submit the bug report I can submit a review for my change to configure the number of rows to buffer15:11
*** Alex| is now known as Alex|off15:20
*** Alex|off is now known as Alex|15:20
SlimeyPetebah. I was going to just submit the bug-report anyway, but it won't let me unless I pretend we're running 2.0.215:29
grantci won't tell anyone15:29
SlimeyPete:)15:31
SlimeyPetek, submitted15:31
SlimeyPeteif you need more detail then just poke me and I'll see what I can do15:31
SlimeyPeteI suppose I could've included the code from our wrapper script but it's basically just the same as the examples on the wiki15:32
SlimeyPeteexcept with an extra ingres_commit()15:32
*** troal01 has left #ingres15:32
grantcwhat was your memory limit under php 4?15:34
SlimeyPete8MB.15:35
pboropretty low15:35
grantcerm yeah15:35
SlimeyPeteso it seems, but it worked15:35
SlimeyPeteand now it doesn't even get through the little preliminary queries on this particular page; there's a *way* bigger one further on in the code which the PHP4 system is perfectly happy with.15:36
SlimeyPetePHP5 hits the limit before it even gets to the big one15:36
SlimeyPeteI suspect I'll wind up recommending that we raise the limit quite significantly, but my boss won't be happy about doing that instead of figuring out why our script is suddenly consuming so much more RAM15:37
grantcSlimeyPete, can you put "memory_get_usage()" in between each Ingres call and paste the results into pastebin?15:38
SlimeyPeteSure. Give me a few minutes.15:39
grantcok15:39
*** Alex| is now known as Alex|off15:42
SlimeyPeteany particular pastebin preferred?15:43
grantcingres.pastebin.org15:44
grantcsorry .com..15:44
SlimeyPetehttp://ingres.pastebin.com/m6d700a9a15:45
SlimeyPetethat's in before, after & inbetween ingres_query and the ingres_fetch_array calls15:45
grantcok sounds good - what if you add ingres_free_result($result) after the fetch and get another memory count?15:45
grantcalso if you do ingres_fetch_array($result,INGRES_ASSOC)15:47
pboroE_PS03A0 Subselects are not supported inside join qualifications.15:47
pborodamnit :)15:47
SlimeyPetegrantc: I've been called away so gimme another few minutes but it seems that ingres_free_result did something good15:49
*** Alex|off is now known as Alex|15:50
grantcSlimeyPete, no problem15:50
*** Alex| is now known as Alex|off15:52
*** Alex|off is now known as Alex|15:52
SlimeyPetegrantc: Hmm. The addition of free_result has massively reduced the memory usage. It's now peaking at ~800k instead of 8MB15:53
grantcthe older driver would only allow for a single result set to be open which would limit any impact15:54
grantcthe new one the restriction is dependant on the number of cursors ingres lets you open15:54
SlimeyPeteI guess this is the solution then, though I shall speak to my boss about increasing our memory limit anyway15:54
grantcok - looking at the php.ini-recommended that comes with 5.2.8, memory limit is now 128M15:55
SlimeyPeteHmm... though hang on15:56
SlimeyPeteI may have put it in a slightly dumb place in the code15:56
SlimeyPetedoes free_result just clear the buffer or does it completely wipe the result-set including rows that haven't been retrieved using fetch_array yet?15:57
grantcthe latter15:57
SlimeyPeteAh, doh15:57
SlimeyPeteSo putting it in the loop which is fetching the results row by row was a silly thing to do then :D15:58
SlimeyPeteif I put it just after the array, we're still talking megabytes of memory usage and it does hit the limit15:58
grantca go faster stripe :)15:58
SlimeyPetejust after the loop, I mean15:58
grantcif you add INGRES_ASSOC to the call to ingres_fetch_array15:59
grantc?16:00
SlimeyPetethat doesn't seem to make much difference, if any16:00
SlimeyPete1140080 - 722440016:01
SlimeyPete^^ bytes, before & after results are fetched16:01
grantcok16:01
*** troal01 has joined #ingres17:59
*** DerMeister has joined #ingres18:12
*** Alex| is now known as Alex|off18:53
*** clach04 has joined #ingres19:03
clach04in0319:03
clach04ingbot help19:03
*** troal01 has left #ingres20:12
*** grantc is now known as grantc_offline20:30
*** rossand has quit IRC20:48
*** rossand has joined #ingres20:54
*** ChanServ sets mode: +o rossand20:54
*** DerMeister has quit IRC21:53
*** DarylM has quit IRC23:13

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!