I have php web applications, mostly on reporting section if a report is taking long for one user, it stops whole server, means all other clients or users wait for his request to finish after that their page loads completly.
What are possible ways to remove this in web (server client) applications?
how can we do specifically in wamp/PHP. something like restrict user to use server so that it do not affect other users...
MORE SPECIFIC DETAILS:
I have data entry appliactoin about 2000-4000 records being entered per 4 hours by multiple users.
as admin each record then (about after min 10 mins) I need to check in another application through web service and get more information and updating that record fields.
I noticed if i am running this re-checking in loop. All other users complain they can not use application.
Asked
Active
Viewed 58 times
0

alamnaryab
- 1,480
- 3
- 19
- 31
-
Does this answer your question? [Simultaneous Requests to PHP Script](https://stackoverflow.com/questions/1430883/simultaneous-requests-to-php-script) – gre_gor Jan 31 '20 at 20:34
-
Presumably a locked database table... I think the only way to de-stretch it would be a master-slave replication, where the users act on the master (read/write) and the report generation is done purely on the slave (read-donly). Thus, anything users enter will eventually be in the slave and the report generation will not lock tables in the master (eg. for users). Alternatively, generate a report not on click, but in low-traffic times per cronjob. – Honk der Hase Jan 31 '20 at 20:37
-
let say one user requested report it will request slave and another requested same report so he will wait for it. there are some realtime requests which i can not schedule. – alamnaryab Jan 31 '20 at 20:43
-
1Are you using a **session** in this request that blocks? Because PHP sessions lock by default. All other incoming requests for the same session will block until the lock is released (on `session_write_close`). Make sure you don't start the session for any longer than is needed (i.e call `session_write_close()` immediately after you're done with the session to release the lock as quickly as possible even if the request needs to continue doing other stuff). – Sherif Jan 31 '20 at 20:49
-
1Typically, though, you want to move any long-running request to the background and away from any web-facing interface. – Sherif Jan 31 '20 at 20:50
-
^ Session locking has definitely bit me before. Although other users really shouldn't be accessing the _same_ session – Patrick Q Jan 31 '20 at 20:50
-
Are your tables InnoDB? – Patrick Q Jan 31 '20 at 20:56
-
yes innoDB as i needed transactions – alamnaryab Jan 31 '20 at 21:02
-
Can you please elaborate this statement? "I noticed if i am running this re-checking in loop. All other users complain they can not use application." Do you fire SQL queries in a loop? – Honk der Hase Jan 31 '20 at 21:06
-
Select whr sync=0 let say got 100 records then based on these values hit webservice then update current record fields based on webservice values and sync=1 then move to next record this takes more than 5 minutes for 100 records – alamnaryab Feb 01 '20 at 22:05