spiceman Posted February 24, 2010 Share Posted February 24, 2010 Current Scenario: > Php communicates with Flash playlist player > users are able to create playlists for a flash player on site > Flash Player will play songs based on playlist id which contains the associated trackids > Flash player plays trackmp3 according to direct path of track ID > SQL request is initiated when playlist loads > Playlist is can be embedded on other pages How do I reduce the MYSQL connections with the above scenario? Is there any thing i can incorporate like reading from an XML file or something to reduce load or improve optimization as more ppl start embedding the player? I ultimately think that something is wrong with the overall PHP design/solution that the programmer has... Link to comment https://forums.phpfreaks.com/topic/193282-noob-alert-optimize-playlist-player/ Share on other sites More sharing options...
Psycho Posted February 24, 2010 Share Posted February 24, 2010 Not really enough information really. I am assuming that the playlist that the user creates only contains track IDs and that is why you have to do a database query to get the track path? I did something similar before, but in a very different process. For my application, I did not want the user's to be able to access the music files directly. So, in my application I allowed the user to create "playlists" via a webpage. Those playlists were just database records. Then, when a user selected a link to play a playlist I would do a single query to the database to get the tracklist for the playlist (all I would get were the track IDs from the database). I would use the results of that query to build an actual flat-file playlist that could be consumed with the user's default media player. I would never actually write the file to disk - I would just use the appropriate headers to send the file to the user. Also, the actual playlist file would contain links such as www.mysite.com/playfile.php?id=23 www.mysite.com/playfile.php?id=187 www.mysite.com/playfile.php?id=93 The user's media player would make a request to the URLs above and that page would do a query to get the mp3 location and, using the appropriate headers, send the file to the user. I never had a problem with performance because I never had a ton of usage, plus when a user selected to play a playlist they would only be doing a database request once every 3-5 minutes. Link to comment https://forums.phpfreaks.com/topic/193282-noob-alert-optimize-playlist-player/#findComment-1017751 Share on other sites More sharing options...
spiceman Posted February 25, 2010 Author Share Posted February 25, 2010 i appreciate the insight... i will reread this post and see what else i can ask ... but it sounds that you do a single query for playlist... and it doesn't query for each song afterwords... i will check if mine does that. Right now i am getting max_connection issues and cpu spikes and i think its related to the playlist... i'll come back later to bother you.. thanks again... Link to comment https://forums.phpfreaks.com/topic/193282-noob-alert-optimize-playlist-player/#findComment-1017980 Share on other sites More sharing options...
Wolphie Posted February 25, 2010 Share Posted February 25, 2010 Possibly a good idea to enable some form of caching too. Link to comment https://forums.phpfreaks.com/topic/193282-noob-alert-optimize-playlist-player/#findComment-1017985 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.