Common large Web page static solution

Source: Internet
Author: User

Large Web site Architecture Technology Collection Articles update list

Http://www.cnblogs.com/ruthon/p/4477899.html

Multiple file servers read and write, SMB protocol is used here
Page static, can be used Freemarker open source framework
If a large number of read-write requests are considered, a distributed or scheduled approach will be requested to address
1th we should first consider the file server and Static page mapping relationship, that is, what file should read and write to which server, the simplest way to do this is to randomly map, and then save the mapping relationship to the database, SMB common operation code is as follows:

 Public Static BooleanExists (String filepath,string username,string pwd)throwsException {smbfile file=NewSmbfile ("smb://" +username+ ":" +pwd+ "@" +filepath); Try{ returnfile.exists ();}Catch(Exception ex) {return false; } }  Public Static Booleanfilerename (String filepath,string newfilename,string username,string pwd) {Try{smbfile F=NewSmbfile ("smb://" +username+ ":" +pwd+ "@" +filepath); if(F.isfile ()) {String str=filepath.substring (0,filepath.lastindexof ("/")); STR= "smb://" +username+ ":" +pwd+ "@" +str+ "/" +NewFileName; F.renameto (Newsmbfile (str)); }Else if(F.isdirectory ()) {String str=filepath.substring (0,filepath.length ()-1); STR=filepath.substring (0,str.lastindexof ("/")); STR= "smb://" +username+ ":" +pwd+ "@" +str+ "/" +NewFileName; F.renameto (Newsmbfile (str)); } return true; }Catch(Exception ex) {return false; } }  Public Static voidmkdir (String dir,string username,string pwd) {Try{smbfile F=NewSmbfile ("smb://" +username+ ":" +pwd+ "@" +dir); if(!f.exists ()) F.mkdir (); }Catch(Exception ex) {}} Public Static voidmkfile (String filepath,string username,string pwd) {Try{smbfile F=NewSmbfile ("smb://" +username+ ":" +pwd+ "@" +filepath); if(!f.exists ()) f.createnewfile (); }Catch(Exception ex) {}} Public Static voidmkfile (String filepath,string username,string pwd,string content) {Try{smbfile F=NewSmbfile ("smb://" +username+ ":" +pwd+ "@" +filepath); if(!f.exists ()) f.createnewfile (); WriteFile (FILEPATH,CONTENT,USERNAME,PWD); }Catch(Exception ex) {}} Public Static BooleanIsdir (String filepath,string username,string pwd)throwsException {String dir= "smb://" +username+ ":" +pwd+ "@" +filepath; Smbfile F=NewSmbfile (dir);returnf.isdirectory ();}

2nd, the page static can be generated by freemarker, the use of Freemarker is relatively simple, I am not wordy here, repeated said
3rd, the dispatch center, or the static request to save to the task, and then through the dispatch center asynchronous execution, can be said in my blog another article to solve the

Common large Web page static solution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.