Avatar of umaxim
umaxim
Flag for United States of America asked on

PHP

Hi i have a system which parse XML file with news. It gets it of article in database and then if it not there it add to database. But the problem is to many connection because it check every 15 minutes and it have 30 queries to database. So i thinking to make some cache for it maybe save last answer from XML and compare to new one and if it now the same then it begin checking. Or i thinking create some TXT file with all id of articles and then compare it to it. What else you can recommend what can help me ?
PHP

Avatar of undefined
Last Comment
umaxim

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Bardobrave

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
umaxim

ASKER
Yes i do not close them after how i can close i just new in regular programming. I every time use codeigniter it close connection by it self. What you can recomend m.
Bardobrave

I don't know about CodeIgniter, it's some type of framework for PHP, I think.

Suposedly it should have some type of gargabe collection that closes any open connection when finishing to execute code, but I don't know if actually it has.

Keep in mind that your database will have a limit to the number of concurrent connections it can manage, also, more open connections means more resources.

You should try to use the minimum number of connections on your code, usually you create them on the fly when accessing database and close/destroy them when database operations are finished.

If you keep your database connections open, on the long run you'll find that your database runs slowly and, eventually, it blocks any further operation due to a too many open connections error.

The way you close your database connections on php could vary depending on the database.

This site has a full reference on PHP:
http://www.php.net/
umaxim

ASKER
Thank you for help i found what was the error. I used persistent connection in my script and server every time show error too many connection. Thank you for help.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck