pcbytes Posted March 20, 2007 Share Posted March 20, 2007 I am building a templates site with MySQL backend. I am storing the background images, CSS, etc for the layout all in the database. So everytime someone views a webpage at XYZ persons site, it pulls the content from my database. Now assuming my website takes off and I get lets say 1000 people to use my templates. That could mean 1000's of queries hitting my database at once to pull down background images. **************************** I've been building it this way because it makes it easier. When i create the template I dont have to manually edit the <img src="someoutsidesite/somefilename.jpg"> The database takes care of all that for me! End result for me... I dont have to spend hours hand coding templates because its all filled out by SQL. But what are the long term results. Can mySQL handle my needs if my site becomes popular? Quote Link to comment Share on other sites More sharing options...
obsidian Posted March 20, 2007 Share Posted March 20, 2007 Are you actually storing the background image itself as a BLOB in the database, or are you simply storing a reference to a local file? There is a huge difference in server load for those two queries. I would have no worry at all for 1K consecutive users querying for the location of a background image from my database since I'm simply returning a string value to them. On the other hand, if I have people hitting my DB and actually trying to pull an image from my DB, there will be problems. Grant it, if the images are tiny, you may not immediately see a problem, but in my experience, it's a poor design to put that much load on a SQL server. Out of curiosity, if you are creating templates for use or sale, why on earth are they connecting to your server to display it? Are they just personalized pages that people are using that are all hosted on your server, or are they actually connecting to your database server from their own? If it's the latter, this opens up a whole new security issue... Quote Link to comment Share on other sites More sharing options...
pcbytes Posted March 20, 2007 Author Share Posted March 20, 2007 in answer to your question yes. I was programming it to store the background as a blob to in an effort to alleviate me from having to manually directory path to the image. I had it so I just upload the background image and it spits out the CSS code with a link to the databased image. Much easier to hit browse image/upload than hardcode each CSS page. But if it's going to cause my SQL to take a dump later on I could take it out. The site isn't live, just on my sandbox. Quote Link to comment Share on other sites More sharing options...
obsidian Posted March 20, 2007 Share Posted March 20, 2007 What about my second question: are you hosting all the sites that use your templates on your server, or are you opening up your database server for people to host their own sites, but use your database for the images and CSS? Quote Link to comment Share on other sites More sharing options...
pcbytes Posted March 20, 2007 Author Share Posted March 20, 2007 No I am not hosting the sites. The sites are hosted externally. The only thing I would be hosting would be the background images on these peoples templates. Quote Link to comment Share on other sites More sharing options...
obsidian Posted March 20, 2007 Share Posted March 20, 2007 No I am not hosting the sites. The sites are hosted externally. The only thing I would be hosting would be the background images on these peoples templates. I would recommend you really think this through, then. First, you are going to have to open up your MySQL database for connection via other servers. This can be a very dangerous thing if you're not extremely careful. First off, remember that if they have the source, they have all your database connection information. You'll have to make sure that you have a MySQL user created that has only SELECT rights granted, or you're going to have people editing your tables on you. I guess I'm still struggling with the reasoning behind hosting the template yourself. Every other template system I'm aware of lets me purchase and download it. With that, I'm able to make modifications to fit my needs. If you are hosting all the CSS and images, you are severely limiting the customization ability of your end user. I'm not trying to discourage you entirely, but I do want to make sure you've considered all the ramifications of the design process you're following, too. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.