D
D
des1roer2015-02-02 15:54:41
PHP
des1roer, 2015-02-02 15:54:41

PHP or python structure question?

This is not a holivar, but a specific task. There is a base on postgres. And she's been feeling really bad lately. We have at this stage - cron runs a python script that scoops up data for charts for the last day every 5 minutes. in total we have 250k records in a text file on the server (chart id, value, time). in php, using ajax, I scoop out the data and parse, depending on the chart, what data to display. seems to be blasphemy. ff loads data in 1 sec. but the donkey processes the data for 10 seconds. so the performance gain is low.
attention, experts, the question is how to optimize this business. It seems to me that python should be faster in parsing values ​​by ID. but the question is - can the php page run the script and how to pass the tag values?
and if you do it using php, then transferring the tag values ​​​​and time using a get or a post is a trifling matter. but again it will be parsed by the server and it seems like from empty to empty? who would have done it?
----------
for simplicity - I want to implement a schema (query to the database from python -> create a file of ALL values ​​-> php \ python data parsing -> the end user from the php page accesses data only for his charts )
stalled on the text file parsing toolkit. php - seems easy, but what about performance? python - like a cool PL, but how to pass the id of the tags and is it even possible?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey, 2015-02-02
@des1roer

I understand correctly that you have a problem with the performance of the donkey in terms of data processing? That is, you have a problem with JS ... neither PHP and Python will help here - look for what the problem is (for example, you have too much data) and think about how to divide this matter.
Here, background workers are more suitable and loading data in parts.
In short, reread your question and express your thought more precisely. For now, one can only guess.

I
IllusionTurtle, 2015-02-02
@IllusionTurtle

1) standard web scheme: the user opens the php\python page, connects to the database and draws the necessary graphics in his browser, JS can also be drawn so as not to load the server.
I don't think that you have a hundred graphs there and each graph is in a multidimensional space...
2) the script (php\python) is run by cron, reads the database and DRAWS graphs in png format.
the user connects to the web server and sees the finished pictures as static.

M
mukizu, 2015-02-11
@mukizu

If you are parsing data on the server side, then for the client (a library that draws graphs) there is no difference whether there is php or python - it receives already prepared data. One way or another, on 250k records without some fierce tricks, you will not notice the difference in speed from switching to python.
If the problem is on the client side, then the problem is in js, for example, while working in IE, the library creates some objects that are in Fx, but are not in the donkey.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question