Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I want each time a new lesson is added to the lessons table, a notification send to all students in that grade. Let's say I have 10,000 students in the fifth grade, that means a 10,000 insert operations will be made in the notifications table which is a huge load.
Is there a better idea on how to send notifications to users, knowing that a user can see the notification only ONCE.
It seems that the notification process can be made asynchronously.
I suggest to develop a separate message queue architecture for this scenario. A program will loads newly added data and put them in a queue, then another process can read the queue and (for example send emails to users). You can add more queue consumer to manage more huge data.
Of course you will need a MQ Server.
To get a filling of asynchronous development see http://www.rabbitmq.com/getstarted.html which have good examples of Rabbit MQ ( Rabbit MQ is a opensource java base messaging service).
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
In this tutorial, to run two consumers, I open two consoles and type php worker.php into each.
https://www.rabbitmq.com/tutorials/tutorial-two-php.html
Instead I want to create some workers when a user logs in, and destroy those workers, when logging out. Is this possible within the php framework, If not what route might I take using bash scripts or similar?
[edit: more info]
Under normal circumstance I might spin up a few workers to do some tasks that take a long time. For my website I would like up to eight identical workers for every logged in user. Destroying the workers after use is no so much an issue. But If I spin up 16 workers(for two concurrent users) and a third person logs into my website I would like another 8 workers to be initiated.
I could check the logs each day, find out what was the max concurrent users and spin up the required number manually, but I'm assuming there is a better way.
The answer is: Yes, it is possible. The best solution depends on the project details.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I have a Social Network type Laravel application where users can comment and follow each other, and subscribe a page/user to get notification whenever a new blog/post has been published by the page.
Suppose, 1000+ users has subscribed to get notification for a page. Now, whenever the page publishes a post, I should send notification to all users who has subscribed.
I have a table for notifications like:-
user_id - the user who has subscribed
page_id - the page who published the blog/post
notification - the notification text (same for all users)
Basically, I want to send the notification to all users who has subscribed to the page. In laravel, I can use loop or chunk for all users to add rows to the database. But I want to know what will be the most robust way to send notification to users in laravel. Thanks.
Definitely consider looking into Laravel's Queue for this. It will give a fine tuned control over how many get sent at once, when they get sent and how to handle the case of failure. I use the Queue + Redis for a lot of very similar functionality. https://laravel.com/docs/5.4/queues
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I created table account here 5 columns a/c_no date, deposit withdraw balance. I need to insert data automatic after 2 days with date and value of interest. How to code this?
For this you have make a scheduler kind of thing, that runs on scheduled time and do the assigned task with the specified logic. In linux, cron is there for this purpose.
Cron Jobs are used for scheduling tasks to run on the server. They're
most commonly used for automating system maintenance or
administration. However, they are also relevant to web application
development. There are many situations when a web application may need
certain tasks to run periodically. Today we are going to explore the
fundamentals of Cron Jobs.
Reference
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have a POS software developed in PHP and running as a web application.
I need to have dual monitors, one facing the employee with full details (sales screens showing heaps of options) and another monitor facing the customer with summarized information (ex. item, price list only)
How can that be achieved?
Many thanks
Because your dealing with the web, event driven development is not going to be possible. So to get around this, you will need to have two browser instances (1 per monitor) where the waitress side will need to do an ajax push on each update and the customer end will need to do some kind of ajax polling based on a timer. There is a lot of information all over the internet about how to accomplish this sort of thing. Take a look at Push notification to the client browser for some more discussion on the topic. There are some less supported methods you maybe able to leverage like realtime push notifications or multipart/x-mixed-replace MIME type or Comet or HTML5 Websockets.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
So I have an app that includes peer to peer chat, which is only between two users at a time. What I am doing now is upon the user typing a new message, it calls a PHP script which inserts the message into a mysql table. then every 5 seconds the code calls a php script which downloads all the messages. So there is a maximum 10 second gap between messages. So my question is if there is a better way to do peer to peer chat.
You can use the server as a matchmaker - use it only to find the other phone. You provide the IP address so that one phone can contact the other phone and initiate a connection. One of the phones act as a chat server.
You can read about sockets programming with Cocoa for example here: http://cocoawithlove.com/2009/07/simple-extensible-http-server-in-cocoa.html
You can check out something like IP Messaging with Twilio.
In the iOS quickstart (https://www.twilio.com/docs/api/ip-messaging/guides/quickstart-ios) you can try it out in Objective-C or Swift.
The server side app there (in PHP) manages identity and access tokens for the application and the simple/example UI you end up with is this:
[Note: I work for Twilio]