dear! I ask for your help! I went over and tried a bunch of different options and completely lost hope of success ... I am writing a diploma, created a universal software in the php language, with which you can connect (via ODBC) with any SQL-oriented database and perform its performance test ( through the use of queuing theory indicators) by calling the procedures made on the base side, in various load degrees and (!) different number of "clients" working simultaneously with the base. The problem is this: implemented now and everything works fine, but only supposedly in single-user mode, and for my research I need to create the ability to specify the number of users working in the system in order to imitate the request (I / O) queue to the database and explore its length, the number of clients, the average number of applications (request), etc. I thought to solve this problem by using multithreading (call only 1 function, which calls the necessary procedure and returns the time to perform it simultaneously many times and break it into threads), but after reading a lot of information I learned that php does not offer this option out of the box, but tested My methods (pthreads, open_proc (), PHP-FPM were not customizable for Windows / non-working through a browser, etc.) and I was very sad ... If I am on the right choice of a solution to this problem, then I’ll tell you how I can implement it acce in my project (of 1 function must simultaneously cause 10/50/100 times). If there is another solution to this problem, I would gladly try to implement it! Thank you in advance! I use the following set of tools: Windows 10 x64, OpenServer, Apache-PHP-7.

  • Run the script several times, for example, from different browsers. How to simulate that there is a request from several users. Either we upload the script to the serv and ask friends to open at the same time or use "robots" through services. - Alexander Semikashev
  • @AlexanderSemikashev case says. What is the point of branching the process if you can run it multiple times. Do something like a front controller, which will give you the opportunity to specify the number of users and any input settings and by the button will start your processes with the parameters you need for each user. You can pre-arrange your process as a console command and from the control script run it "asynchronously." Of course, you will need them to communicate with each other, like through some radishes, for example, or Sqlite. - zalex
  • pcntl_fork will probably help you, however, it is impossible to return the result to the master process, therefore you will have to write the data of each process somewhere, and then summarize it all. So so little idea, but it should work - StereoFlo
  • Guys, thanks for the advice, but I just need to do research using queuing theory metrics, and it implies some kind of queue from clients that I need to investigate (find the average processing speed of the request (request) by the server, the number of requests in the queue, the queue length and etc.) that's why I need to separate this function in order to get the information I need .. The last action is left to be done and I am seriously stuck, help with the idea, please .. - Serge
  • @Serge you write всего 1 функцию необходимо одновременно вызвать 10/50/100 раз What is the difficulty then? You understand that you can execute any file from both the web server and the console (command line, if you like). If you do not have external data, then you can start your function from the console, right? Well, write the second function in another file where your function will be launched via the console as many times as you like. Those. do something like exec in the php.net/manual/ru/function.exec.php cycle. If your load function is not sharing data, then there are no problems at all. - zalex

0