1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How does Instagram filter hashtags

Discussion in 'Programming' started by Kuna, Jun 22, 2016.

  1. #1
    Since my app has to handle hashtags, for now I limited to max 10 tags users can choose and we have table for it. This is how I structured it. This table where all tags are saved and pulled from:

    [​IMG]

    This table holds relation between tag and location:
    [​IMG]

    I saw on Instagram that while you are typing hashtag it starts to load and search for similar hashtags. How do they handle that hashtag filtering to be fast and effective with so many tags, I guess millions?
     
    Kuna, Jun 22, 2016 IP
  2. sarahk

    sarahk iTamer Staff

    Messages:
    28,500
    Likes Received:
    4,460
    Best Answers:
    123
    Trophy Points:
    665
    #2
    They'll be pulling them off the server in json and building the list from that.
    • fast
    • low data load
     
    sarahk, Jun 22, 2016 IP
  3. Kuna

    Kuna Well-Known Member

    Messages:
    426
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    105
    #3
    But they have to pull everytime from database, everytime I type in soemthing I'm sending a request, isn't that too much
     
    Kuna, Jun 23, 2016 IP
  4. sarahk

    sarahk iTamer Staff

    Messages:
    28,500
    Likes Received:
    4,460
    Best Answers:
    123
    Trophy Points:
    665
    #4
    No, not all. Look at how datatables works with jquery when people type in the filter box with server side processing for an example but you can be sure their version will be stripped down for efficiency
     
    sarahk, Jun 23, 2016 IP
  5. ThePHPMaster

    ThePHPMaster Well-Known Member

    Messages:
    737
    Likes Received:
    52
    Best Answers:
    33
    Trophy Points:
    150
    #5
    Big websites normally do not use MySQL to serve data, it would be a killer. Even when they do, they deploy some sort of clustering, sharding and/or partitioning.

    For example, I know a company that uses MySQL for their backend which serves millions of users (MySQL is ok @ such levels using Aurora with a very big and powerful serve). However, their frontend serves billions of impressions and for that we can not use MySQL, so it ended up using memory storage like Memcached and Aerospike which can handle it (hundreds of servers that work together to split the load).

    Some interesting reads:
    1. http://highscalability.com/blog/201...res-250-million-tweets-a-day-using-mysql.html
    2. https://engineering.pinterest.com/blog/sharding-pinterest-how-we-scaled-our-mysql-fleet
    Personally, I wouldn't worry about it unless you really expect a very large spike in data (somehow your website is about to become famous).
     
    ThePHPMaster, Jun 25, 2016 IP
  6. sarahk

    sarahk iTamer Staff

    Messages:
    28,500
    Likes Received:
    4,460
    Best Answers:
    123
    Trophy Points:
    665
    #6
    The query for tags should be pretty lightweight too so you'd expect it to be fast. I would imagine that returning the result would have a greater overhead which is why json or xml are used.
     
    sarahk, Jun 25, 2016 IP