I Use Zend Framework 1.11 and this is really slow for me.
I Have a button and then, when I click on it, that perform an ajax request.
The response is Small. I Return a
Hello World
The response time is 125ms.
To much for this small ajax request.
Anybody have an idea.
Thanks.
well , it shouldn't take that much , could you please post the code and your os information ,
but i suggest to
run xdebug profiler
http://devzone.zend.com/article/2899
http://www.slideshare.net/samkeen/profiling-php-with-xdebug-webgrind
Are you using anything from:
Locale
Currency
Db
Also try using optcode cache (like zend accelerator). ZF can be slow on PCs with low IO performance while it loads many small files.
We have 125ms response on server for our ecommerce with hardcore optimalization (but without cache).
Related
I am working on zend framework, I can see when i load the because it is getting lots of time to load, and in mysql database there are more than 250+ connections open, I am using zend 1 framework, can anyone please help me what we can do to resolve this issue ? any help will be really appreciated
Those 250+ connection, are in production environment or in test?
How many user that make requests do you have?
Are you using Db or multiDb resource?
Does your html pages make async requests once loaded?
There are lots of variables to keep in consideration to debug this issue
We had an big application written in PHP+js+mysql. some of our bosses, decided (making a big mistake since they are no developers) to give this application in outsourcing for rewritting it from a developer company. They rewritte the application with Zend Framework+ Doctrine, giving us back a very veru very slow application, if in the old application on module to load taked 1 second now it takes 4 seconds.
Till now we have done the impossible to fast up this up: activated cache server, migrate application to linux, caching everything possible but it is still very slow very slow.
I need from all developers experience how to optimize and make faster this application written with zend framework and doctrin2 (we cannot remove doctrine, and we have alreedy implemented the cache system)? tips tricks, ideas any anwser will be welcome.
Same as with any PHP application:
Enable Xdebug on your development machine and do some profiling to see where the bottlenecks are
Enable the MySQL slow query log to see if the queries can be improved
you can also look at the DB profiling features in Zend_Db to see if the app is doing unnecessary queries or loading more data than it needs.
For all website application use this firebug's pluggins for optimize your code, you can really win in performance !
Yahoo Yslow pluggin
Google PageSpeed pluggin
with there, you have a notation for your page, with listing for improve your fastest's application.
After, for Doctrine2 , you can use fetchArray() for few little request, (global, users use fetchAll() ) .
FetchArray is more faster than fetchAll for request, just because fetchArray return just an Array, and fetchAll return all object linked in your request... ( many time, array is sufficient).
Hope I help You.
I'm about to start an iOS project that requires pulling user's data from an SQL Database and viewing it within the App. Before I begin I'm looking for conformation that I'm taking the right (best) route.
My Plan:
App starts on login page (app will display data from another service)
App uses AFNetworking to post request to web service
Web service gets user data from SQL Database and sends back JSON
App uses JSONKit to parse the feed and load into Core-Data
App uses info from core-data to populate UI
Does this seem like an appropriate way to get the info into Core-Data from SQL? Any suggestions for doing things differently?
Thanks.
Are you receiving the response from the web server in JSON? If so, the fact that the server is using an SQL database is immaterial. What you need to know is how to parse JSON for inclusion in a core data store. Cocoa is my Girlfriend has a pretty good tutorial up.
Part 1
Part 2
To answer your comment, here's what I've done.
Display a login screen. The login credentials should be stored in the keychain for security. I've used SSKeychain for this.
To handle sending and receiving data from a web request your best option is to use a pre-built library. I've always used ASIHTTPRequest, but since it is no longer under active development, you should probably look around a bit before you commit to anything. I'm sure there are nicer and cleaner libraries out there.
You need to parse the JSON responses. I'm a fan of JSONKit. It's very fast, very easy to use, very robust.
Pulling data out of the core data store and displaying it in the interface will be no problem for you. If you create a new project in Xcode most of the setup will be done for you.
Now, there are a lot of projects out there that attempt to combine web requests, json parsing and core data loading into one framework. I've tried to use a few of these and haven't had much luck. The ones I've tried haven't been robust and very difficult to debug. Setting up your own request/parse/load code is not difficult at all, just a bit time consuming.
I am sure that there are a lot os ways to make implement this problem. Your solution is one of the popular solutions I guess but you could connect to the DB via a socket and talk with the database directly e.g. Going over a port 80 web site has the advantage that the possibility of some kind of firewall blocking the communication is very low. I would solve this kind of problem the same way I guess.
I want the way with the fastest execution time. I'm not feeling comfortable of using web service because i need to create separate php pages and retrieve data as xml. If you think its good to use web service please tell me why. I want to code my database queries right on my c/objective c pages.
I've been searching for libraries. I saw this sequel pro - won't i have any problems on using this - like licensing issues? I also saw this libmysqlclient of cocoa but some say its not working well. I've also read about a library developed by Karl Kraft found here http://www.karlkraft.com/index.php/2010/06/02/mysql-and-objective-c/ but don't know if i could trust this.
I would really appreciate you help.
Definitely build a web service to act as an abstraction layer to your database. Here are some significant reasons in my opinion:
Since you want speed, you will be able to add caching when using the webservice, so you will essentially eliminate the need for identical queries to run (sometimes).
If you need to change your data model later, you just have to modify the webservice backend and don't have to update your app.
You can better control security by not exposing the database to the world, and keep it safe behind the web service.
Your database credentials should not be stored in an app. What if you needed to change those?
I strongly suggest a web service. Hope this helps.
Connect to your DB by PHP and output the result as JSON
is much better and faster then xml and less coding if use JSON Framework.
and never never try to connect to your DB from your iphone because it easy to sniff out the request from iphone.
Being safe then Sorry, keep that in mind
I am a beginner at both iPhone programming and SQL, yet I have basic knowledge of them.
I am planning to do an application that would plot a graph from data taken from a database of the server of my company. I know how to plot, I know how to extract data from an sql table, but what I don't know is how to access the server.
So do I have to go through some kind of oracle-like application ?
This may seem like a very stupid question because it might not even be possible but any answer will be appreciated.
Thanks !
Go through a web service for example a PHP page that returns JSON (or XML, but JSON is easier to parse).
I can highly recommend this tutorial
Once you have your web service, you can use NSURLRequest/NSURLConnection to download the data and use a JSON framework to parse it. Or, if you're using XML you can use NSXMLParser.
See this apple code for more info on downloading using NSURLConnection.
The best way for this will be, using APIs at server end that handle the client request and perform database interaction, so transfer of data among device and server, take place through XMLs that will be secure as well as fast.
It is definitely possible to contact a server (I can't imagine what would happen without that!). What you are looking for is NSURLConnection. Have a look at the example provided by Apple.