I'm a PHP dev, and I have been doing that for 10 years. I want to challenge myself and simulate social network activity, for example, something simple: liking posts and following people. For this example let's take a case where I have 100 generated ("fake") users and 1 real user (me).
I was thinking about 2 possible approaches:
1st approach
I act on behalf of generated users. For example real user posts a picture:
- Event is dispatched
- code takes random 80 users and assigns them as followers
- code takes random 50 users and assign them as they like the picture
That is a pretty straightforward approach, where code takes actions based on events (pic posted, user registered) and assign fake users to certain actions. I could use queues and workers on the server to approach this.
2nd approach
Each fake user acts as a real user. So in my case it would be 100 users but each user programmatically acts as a real user. That would mean that I would need to have 1 worker for each fake user, and then trigger user on every event that happens, like: user registered, user posted a pic and so on.
My thoughts
For example event is "user registered" and that event is distributed:
1st approach: I assign X number of users to be followers
2nd approach: each fake user "decides" (it can be random decision true/false) to follow a user or not
2nd approach seems more natural and more user based vs 1st approach where I just manipulate with fake users and assign them actions. I know AI would be great for it, I'm opened for that suggestions also. RIght now I'm just trying to figure out how to approach the problem and what would be possible solutions.
What worries me is how do I make each fake user to react to events, that means each user needs to be ran as a new process?
I was thinking about 2 possible approaches:
1st approach
I act on behalf of generated users. For example real user posts a picture:
- Event is dispatched
- code takes random 80 users and assigns them as followers
- code takes random 50 users and assign them as they like the picture
That is a pretty straightforward approach, where code takes actions based on events (pic posted, user registered) and assign fake users to certain actions. I could use queues and workers on the server to approach this.
2nd approach
Each fake user acts as a real user. So in my case it would be 100 users but each user programmatically acts as a real user. That would mean that I would need to have 1 worker for each fake user, and then trigger user on every event that happens, like: user registered, user posted a pic and so on.
My thoughts
For example event is "user registered" and that event is distributed:
1st approach: I assign X number of users to be followers
2nd approach: each fake user "decides" (it can be random decision true/false) to follow a user or not
2nd approach seems more natural and more user based vs 1st approach where I just manipulate with fake users and assign them actions. I know AI would be great for it, I'm opened for that suggestions also. RIght now I'm just trying to figure out how to approach the problem and what would be possible solutions.
What worries me is how do I make each fake user to react to events, that means each user needs to be ran as a new process?