B
B
by_roXe2014-05-30 19:21:06
PHP
by_roXe, 2014-05-30 19:21:06

How to find a competent way to implement a currency rate parser?

Good afternoon, there is a news site on wordpress, it has a regular parser (on php) that takes exchange rates from the site of the national bank, it turns out that each user, when entering the site, connects to the national bank and receives rates.
Now the site's traffic has gone up, reaching 10,000 people a day, and I noticed that the site began to slow down, etc. Now it's time to optimize the code.
Actually, what is the question, how to competently implement the function of parsing exchange rates on the site.
1. Leave it as it is, let each user connect to the National Bank when navigating through the pages - a lot of them can easily connect to the National Bank website.
2. Once an hour, let the site itself connect to the National Bank, pick up exchange rates and store them in its database, and users already receive the rate from the database of our site.
Both the first and the second method seem to be not very good, because in the second case, we get extra queries to the database.
Maybe you can suggest an alternative? We need a competent solution in terms of optimizing the site, reducing the load.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Kuleshov, 2014-05-30
@by_roXe

I do not quite understand how there can be several solutions to this issue? 1 time per day, according to the scheduler (cron/php/whatever you want), after 12-00 (usually at 14-00 it’s already possible) pull the course for tomorrow and save it to yourself (to the database, to a file, anywhere), and then use... For example, create a file exchange.php in which you store:

<?
$RATE['USD'] = 34.6481;
?>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question