473,769 Members | 2,365 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Is PDO incompatible with caching mechanismes like APC?

Hi

APC doesn't like it when I store the output of a SELECT:

===
include("apc.ph p");

$dbh = new PDO("sqlite:./test.sqlite");

$sql = "CREATE TABLE IF NOT EXISTS mytable (name TEXT)";
$dbh->exec($sql);

$sql = "INSERT INTO mytable VALUES (?)";
$insert = $dbh->prepare($sql );
$insert->execute(array( "dead"));

$sql = "INSERT INTO mytable VALUES (?)";
$insert = $dbh->prepare($sql );
$insert->execute(array( "beef"));

$sql = "SELECT * FROM mytable";
store("rows",$d bh->query($sql)) ;

$rows = fetch("rows");
foreach($rows as $row) {
print $row['name'] . "<p>";
}

$dbh = null;
===
PHP Fatal error: Uncaught exception 'PDOException' with message 'You
cannot serialize or unserialize PDOStatement instances' in
/usr/local/www/apache22/data/apc.php:9\nStac k trace:\n#0 [internal
function]: PDOStatement->__sleep()\n# 1
/usr/local/www/apache22/data/apc.php(9): apc_store('rows ',
Object(PDOState ment), 0)\n#2
/usr/local/www/apache22/data/test.php(21): store('rows',
Object(PDOState ment))\n#3 {main}\n thrown in
/usr/local/www/apache22/data/apc.php on line 9
===

Does it mean that PDO won't work with APC, and I should look at
another caching tool?

Thank you.
Mar 30 '08 #1
3 2465
On Sat, 29 Mar 2008 20:54:08 -0700, Jeremy <je****@pinacol .comwrote:
>It seems like what you want to do is store an array of the rows, which
is perfectly possible. Just use $dbh->query(...)->fetchAll() or
something similar.
Thanks for the tip. This code works:

$sql = "SELECT * FROM mytable";
$sth = $dbh->prepare($sql );
$sth->execute();
store("rows",$s th->fetchAll());

$rows = fetch("rows");
foreach($rows as $row) {
print $row['name'] . "<p>";
}
Mar 30 '08 #2
On Sun, 30 Mar 2008 13:26:45 +0200, Gilles Ganault <no****@nospam. com>
wrote:
>Thanks for the tip. This code works:
It works, but according to "ab", it's much slower to use APC than
hitting the SQLite file directly :-/

========
# ab -kc 10 -t 30 http://localhost/test_apc.php

Percentage of the requests served within a certain time (ms)
50% 105
66% 1054
75% 2066
80% 3089
90% 4347
95% 8136
98% 10140
99% 12148
100% 13115 (longest request)
========
# ab -kc 10 -t 30 http://192.168.0.2/test_direct.php

Percentage of the requests served within a certain time (ms)
50% 29
66% 30
75% 31
80% 32
90% 2038
95% 6072
98% 14049
99% 17056
100% 17199 (longest request)
========

Does APC start making sense with a lot more users, or is SQLite just
much faster than MySQL?
Mar 30 '08 #3
Gilles Ganault wrote:
On Sun, 30 Mar 2008 13:26:45 +0200, Gilles Ganault <no****@nospam. com>
wrote:
>Thanks for the tip. This code works:

It works, but according to "ab", it's much slower to use APC than
hitting the SQLite file directly :-/

========
# ab -kc 10 -t 30 http://localhost/test_apc.php

Percentage of the requests served within a certain time (ms)
50% 105
66% 1054
75% 2066
80% 3089
90% 4347
95% 8136
98% 10140
99% 12148
100% 13115 (longest request)
========
# ab -kc 10 -t 30 http://192.168.0.2/test_direct.php

Percentage of the requests served within a certain time (ms)
50% 29
66% 30
75% 31
80% 32
90% 2038
95% 6072
98% 14049
99% 17056
100% 17199 (longest request)
========

Does APC start making sense with a lot more users, or is SQLite just
much faster than MySQL?
This is off topic in this newsgroup.
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===

Mar 30 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2016
by: Neil Sargent | last post by:
This is a general posting of how I fixed a problem created by using the Access 97 ODE Setup Wizard on a Windows XP machine. I hope it helps anyone who comes across the problem saves them the 3 days its taken me to sort out. The application generates the following error: "Incompatible version of the RPC stub" This occurs when trying to run Outlook to send an email. However I expect it would occur for any operation which uses...
15
3419
by: olle | last post by:
Hi folks. I learning asp.net and compare it with traditional asp and Access-developing. The issue is this one: 1/I have this Ms Acceess adp-project application that works fine on my Ms Sql server database. In my main form I have an Access-combobox with Customer-names from my customer table. In this combo-box are about 2000 records.
0
1741
by: Troy Simpson | last post by:
Hi, I have a website which is made up of dynamic pages. Each page that's loaded has some code which looks at which template to load amongst other things, which causes the page to take a little while to be processed. At the moment I have programmatic page caching in the "loader" using paramater caching to send a cached version of every requested page back to the user. How can I get particular elements inside each page to cache without...
0
1771
by: Brian Takita | last post by:
Hello, I'm getting the following error at the end of this message when trying to run the ReportManager and the ReportServer: Assembly system.data.dll security permission grant set is incompatible between appdomains. I had to apply KB 887787 (http://support.microsoft.com/?kbid=887787) to fix my previous error, which stated... Assembly microsoft.web.validatepathmodule.dll security permission grant
5
7857
by: Raj | last post by:
What is the purpose of file system caching while creating a tablespace? Memory on the test server gets used up pretty quickly after a user executes a complex query(database is already activated), after some investgation i found out that most of it being consumed by filesystem caching... thanks to Liam and Phil Sherman for their valuable suggestions. Is it safe to turn off filesystem caching on every tablespaceon the server(i.e. DIO) ??...
2
6139
by: George1776 | last post by:
All, I've recently upgraded our production ASP.NET/C# application from framework 1.1 to 2.0. Since then I've been plagued by out-of-memory errors and problems with the cache object (which may simply be a result of being out of memory.) We're running on IIS 5.1 on a single Windows 2000 server. We have a separate database server - SQL Server 2000 64 bit. Session state is stored on the database.
0
2184
by: jason | last post by:
hi experts, support.microsoft.com/kb/917072 and http://msdn.microsoft.com/msdnmag/issues/06/07/WebAppFollies/ As pointed out in these articles, users might get session variables belong to other user ? So ....Session state and kernel-mode output caching don't mix. Has this bug been fixed?
4
2984
by: Hermann | last post by:
My site is a bit slow showing the main page so I thought caching query result in PHP will improve performace. Then I read MySQL documentation and saw that MySQL does have a caching feature. So... now I dont know if doing the PHP caching is worth the pain. Would there be any noticed performace improvement if I cache query results in PHP, considering that MySQL is already caching the queries? Thanks
0
4930
by: srikar | last post by:
Hi all, I am having a problem, when I am compiling the code in 32 bit option on a 64 bit machine using the macro CPPFLAGS= -m32 I am getting the following warnings from the linker . /`../bin/amd64_stat_gnu_02015/WriteFault.o' is incompatible with i386:x86-64 output /usr/bin/ld: warning: i386 architecture of input file `../bin/amd64_stat_gnu_02015/WriteLogic.o' is incompatible with i386:x86-64 output /usr/bin/ld: warning: i386...
0
9586
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10210
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9990
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8869
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7406
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5298
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5446
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2814
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.