very high number of queries in a second. [closed] - php

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 need to design a mobile application which requires a lot of database queries. A lot of means, a peak value can be 1 million in a sec. I dont know which database to use and which backed to use. In client side, i will be using phonegap for android and ios and i will be needing a webinterface for pc also.
My doubts are, i am planning to host the system online and use google cloud message to push data to users.
Can online hostings handle this much traffic?
I am planning to use php as backed. Or python?
the software need not be having a lot of calculation but a lot of queries.
And, which database system to use? Mysql or, google cloud sql?
Also tell me about using hadoop or other technologies like load balancers.
I may be totally wrong about the question itself.
Thank you very much in advance.

From what I understand, if you want to store unstructured data and retrieve it really fast, you should be looking at NoSql segment for storage and try to do a POC using a few of the available solutions in market. I would like to suggest giving a try to Aerospike NoSql DB which has a track record of easily doing 1 Million TPS on a single machine.

Google AppEngine could be the answer, it could be programmed in python or php (or java) and easily support scaling up to millions of requests per second and scaling down to just a few to save the resources (and your money).
they use their own NoSQL db, however there's a possibility to use SQL-based backend (not recommended).

Related

I want to find a best approach to using Firebase as a back-end for Android, IOS & Web Application [closed]

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 3 years ago.
Improve this question
I need to build a application for ios, android & web with some of live data updations (Only one screen) from a calculation functions along with basic Login/Register/Profile/Contact Us/About Us/Blogs.
So I want to know best approach from following three:
Can we use Firebase real-time database as a secondary database for that particular live data which required to sync in real time?
Can we use only Firebase real-time database as a main database for all data with our traditional  approach like restful APIs with php?
Is it possible to use Firebase tools only as full backend development instead traditional php & Mysql/Mongo DB combination if yes what are the steps?
Tools like:
Authentication, Realtime Database, Cloud Storage, Cloud Functions & Firebase Hosting.
There are many things to consider, which is beyond the scope of what we can reasonably answer in a Stack Overflow post. I highly recommend reading NoSQL data modeling, watching Firebase for SQL developers, and also Getting to know Cloud Firestore. While the last one of for Firebase's other NoSQL database, many of the principles explained in it apply equally to both (and many non-Firebase) NoSQL databases.
For your concrete questions:
Yes. See for an example of this Where does Firebase fit in your app? and Build an Android App Using Firebase and the App Engine Flexible Environment.
The Firebase Realtime Database can be used as your primary database. Just keep in mind that Firebase is not meant to be an offline-only database. If you have an app that never connects to the server, you should consider other options.
Yes. I'd recommend checking out the Firebase documentation, and looking for a few tutorials.

Best way to implement my own storage service? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
Let's say I want to implement storage server, which would be used as a place to store files, images, etc. from different websites. Something like S3, but only for my projects.
I thought about some API/Gateway on PHP, which would save files from those websites to appropriate server, but is it a good way? And should I use Webdav or maybe NFS/SMB, which protocol is more secure and fast?
Can you please give me advice how to create my own storage server? Especially I want to hear about appropriate stack for that, thank you.
There are a number of projects for building your own NAS or SAN (I think that is what you're looking for). Look at the FreeNAS project for example. It does require quite a bit of memory though (depending on the size of your storage and the demands you put on it).
When you want to build your own NAS, you will not need very powerful CPU's, unless you want to run apps on the NAS (FreeNAS provides a system for runnning containerized applications on the NAS, using it's storage) but you will need memory and of course plenty of disks, again depending on what your exact requirements are.
However, if you're simply looking for a place to store your own files and they are not extremely large or a huge number of files, then you could simply build a Linux server and push (or pull) the files using SFTP, it only uses OpenSSH and a single port, fully encrypted with minimal overhead.

what is the best way to handle real time notification in php? [closed]

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 want to implement real time notifications like in Facebook. There might be a huge number of notifications to be sent for different users, depending on server load time and efficiency of coding. Which is the best approach?
1. using normal AJAX?
2. with node.js and socket programming?
3. something else?
Thanks in advance.
The choice of the proper platform greatly depends on your current architecture, knowledge, and budget.
Your question suggests that it is web based, for which there are only two basic options:
WebSocket: There exists many WebSocket server solutions including compiled executables, PHP based, and Node.js. This approach is greatly gaining in popularity but isn't necessarily accessible to every budget since it usually requires a complete server to run. VPS limitations are usually too important for systems that require so many simultaneous connections.
AJAX: The use of AJAX and its variants is still a very popular solution and, when well implemented, can be almost as efficient as WebSocket without the need to sustain the connections constantly. It doesn't often matter if there is a one second delay, and Facebook chat is usually much slower than that.
For non web-based solution, anything is possible. If you develop a client-server application, you can have real time connections similar to WebSocket which can be even easier to maintain.
Ajax request not real time but you can set timeout and in this case work.
but the ajax request busy your server and try to many connections. this is simple !
If you use socket it's better but you need more time to develop this.
Read the following link can help you :
Ajax vs Socket.io
Nowadays we have two possible solutions. WebSockets and Comet. WebSockets are probably the best solution but they’ve got two mayor problems:
Not all browsers support them.
Not all proxy servers allows the communications with websokets.
Because of that I prefer to use comet (at least now). It’s not as good as websockets but pretty straightforward ant it works (even on IE).
realtimenotifications more details To know more about refer above link.

Disadvantage of PHP file system based chat system [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I want to implement Chat system on my website where users can interact with each other in rooms. This is my first time when I am implementing chat system.
On searching, I found that phpFreeChat is a good option but on going through its introduction I found that it doesn't use DB at all. So I am wondering, how good in its performance and how much is it flexible as compared to any DB-based approach.
Anyone who have used can please give a viewpoint whether I should go for phpFreeChat so after that I can start learning more about. The website has a huge traffic of around 3 million visits per month.
Any pull based chat system (in which the clients will have to actively contact the server to ask for updates) is hugely resource intensive. Every client will make a request every so many seconds; multiply that by the number of clients and you're very soon DDoSing your own server.
A proper system should be push based, in which every client has a persistent connection to the server and the server is able to push messages to all relevant parties in realtime. This is perfectly possible using web sockets or long poll as fallback. A pub/sub protocol like WAMP is perfect for this use, as are more specialised protocols like XMPP.
Writing to a file or database is entirely unnecessary and would only be a secondary feature for the purpose of data persistence. The server just needs to be a message broker, storage is not required.
Depends on what you need - my first chat application was also file based and it was (and still is) pretty quick, but customizing and adding new functions is a pain in the ass. If your only need is to have quick chat without complex functions, go for file based. If you need to make user rights and other complex things, go for database based system.

Best Android backend for turn-based game? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I was wondering if anyone had any good suggestions for the best backend for an android app with play similar to words with friends. Very turn based, sometimes over multiple days.
The first solution that pops into my head is simple PHP/SQL with responses in JSON as it would be quite easy to implement. Although i am just wondering if anyone has any experience with this and can tell me if it has any big down sides. e.g. Poor scaling, few concurrent users, etc.
Is PHP/SQL a good solution? Should i be looking more at a Java server using TCP/IP? Even for these bursts of messages?
Thanks!
I've used both smartFox socket server (quite awhile ago) and PHP/MySQL to handle "multiplayer state synching" on the web (recently)
In my opinion, for a game that's going to have turns that may span days, a database system would be better. A socket server would have to maintain data in memory that may not be in use for hours or days. PHP/MySQL(or SQL) + JSON would probably be a really good fit. Large PHP sites serve pages to thousands of users and may execute multiple queries per page render so I think scaling should be fine.
The advantage of using a database system is that it can be platform agnostic. Your Android game could run on iOS et al via something like PhoneGap.
EDIT: The disadvantage of a database system is Push notification might be harder to rig up. That's out of my realm of expertise.
I would do exactly what you suggested. It doesn't need to be PHP, but basically you will have a web server (could be nginx, apache, etc), and it can be in any language you want.
One of my favorite methods is using a Django MVC setup, using Python on the backend (for awesomeness of Python) and communicate using an HttpClient (or Https even).
I used JSON as the go between (started with XML, but changed to Json as it's lower overhead usually).
You'll probably also want some kind of a PUSH system set up. Either using C2DM, or a third party API. There's an API I used mostly because it was free & pre-C2DM, called Xtify. It's designed to be used as a geolocation tool, but it has PUSH services (and you don't need to use the Geo stuff). Best part, it's free!
That way, you can have the app open, but not wasting battery life with a POLL loop, and just get when the other player's turns end instantaneously.
EDIT: I just looked and it appears that Xtify charges for anything over 300 messages per user per month... so that's probably not the best option for PUSH services anymore.

Categories