Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8069283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T12:58:47+00:00 2026-06-05T12:58:47+00:00

i’m running a social network with a messaging and notification feature. each time a

  • 0

i’m running a social network with a messaging and notification feature. each time a user sends a message or places a notification for another user, a row is inserted into a table news_updates with the details about the message or notification and all his friends are inserted into the news_seen table. (once the message is read, or the item related to the notification is opened, seen is set to 1, i’m doing this at the end of my callback function for my ajax request – i’m gathering all the newsitem_ids from all the news items, that are currently open and then i’m doing a big insert with all the newsitem_ids in it).

news_seen:

newsitem_id bigint, 
user_id big int,
seen int DEFAULT '0'

at the moment, i’m running an ajax request every 3 seconds, to check the news_updates JOIN news_seen for news.

this turns out to be a huge server load now that i’m getting more and more users. i’ve been reading a lot about xmpp and the like and i think a push notification service would be great for my site.

the only thing is, i can’t really decide on which way to go, since there are so many options.

also, i thought about creating my own system. i’m planning to do it like this:

  • create an xml file for each user on initial registration (and run a batch for the already registered users)

  • once a user sends out a news update (i have my own php function for writing them into the db), i include a small command to manipulate the xml file for the respective friends

  • instead of doing my 3sec ajax request, i’d establish a long connection to the xml file using jquery stream and in case changes were made since the last request, i’d do my usual ajax request that polls the data from the db.

  • instead of running my check_seen inside the ajax request, i’d insert all the new items into a global array, to be used by an intervaled function that tests if any item in the list is currently being viewed.

do you think this is a good idea?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T12:58:48+00:00Added an answer on June 5, 2026 at 12:58 pm

    To be honest I do not think I would implement your specification.

    • For example I would use a lighter data-model then XML. I would use JSON instead.
    • I would avoid touching the DISC(database) as much as possible(slow).
    • Doing two requests instead of one(long-polling/polling). I would try to avoid this.
    • I would probably try to avoid wasting CPU-time by not using interval functions, but only calling function when needed. I would probably use something like REDIS’s pubsub.
    • Polling / Long-polling is (most of the times) a bad idea in PHP because of blocking IO. I found an interesting project named REACT which I believe does non-blocking IO(expensive). I have not tested this(the performance) myself, but this could be an option.
    • For XMPP you will have to install additional software. I for instance liked Prosody for it’s easy installation/usage. Then you would need to have a look at BOSH. For your bosh client I would use strophe.js or JSJaC.
    • I would probably use something like socket.io, Faye or maybe vertx.io instead, because it would scale a lot better.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
I am currently running into a problem where an element is coming back from
I'm parsing an XML file, the creators of it stuck in a bunch social
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
That's pretty much it. I'm using Nokogiri to scrape a web page what has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.