<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">The too many files in a directory can be a pain in the backside if you get to the 100s of thousands - but that’s unto you to create relevant subdirectories. <div class=""><br class=""></div><div class="">Imagine that your website was a retail store selling millions of possible products.</div><div class=""> For search results it depends upon whether results vary per user. </div><div class="">For one site I worked on, if I searched for “green jeans” I could get the same list of pages as you,</div><div class="">and so these pages would be cached sp that if we both requested green jeans nginx would only request the page once.</div><div class="">This is very useful for protecting against denial of service attacks as , for example you can configure nginx to only send</div><div class="">one request at a time for the same url to the back-end, and for other requests to wait and return the same content to each user.</div><div class=""><br class=""></div><div class="">The logic for this caching can be very subtle - if I had was logged in and had preference set “show all prices in Australian dollars”</div><div class="">then I’d expect a different page than you for the same item. It’s also possible that your pages might mix filtering and search -</div><div class="">so I might click predefined categories - cocktail dresses/size 4/red then add free text to search with. </div><div class="">nginx’s caching features are tremendous powerful and can be extended with lua code using, for example, the openresty bundle of nginx.</div><div class="">I was amazed that I never found a use case that couldn’t be solved with nginx functionality, to the point where a tv show</div><div class="">could invite viewers select a specific URL at some point and the hundreds of thousands of requests ended up</div><div class=""> generating only one request for the backend, and the site stayed up under such spiky loads.</div><div class=""><br class=""></div><div class="">My tip is to start simple and add one feature at a time and understand your web server logs, which contain lots of information.</div><div class=""><br class=""></div><div class="">Peter</div><div class=""><br class=""></div><div class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 2 Nov 2018, at 10:45 AM, yf chu <<a href="mailto:cyflhn@163.com" class="">cyflhn@163.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="line-height: 1.7; font-size: 14px; font-family: Arial;" class=""><br class=""><div class="">Thank you for your advice. But may I ask you that how do you store your static web pages on your server? If there are too many pages in a directory, is it possible that the process of looking up the pages could affect the performance of the web server ?</div><div class="">Here I have another question.</div><div class="">For a dynamic website , some dynamic contents can be generated as static pages in advance. e.g the page showing the detail information of a certain product. We know that how many products are there in our websites.</div><div class="">but some dynamic contents are difficult to be generated in advance such as the the contents of some search results. There are lots of search words for a website for which there are too many result items. How should we handle this issue?</div><br class=""><br class=""><div style="position:relative;zoom:1" class=""></div><div id="divNeteaseMailCard" class=""></div><br class="">At 2018-11-02 21:16:18, "Peter Booth via nginx" <<a href="mailto:nginx@nginx.org" class="">nginx@nginx.org</a>> wrote:<br class=""> <blockquote id="isReplyContent" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid" class=""><div dir="ltr" class=""><span class=""></span></div><div dir="ltr" class=""><div dir="ltr" class=""><span class=""></span></div><div dir="ltr" class="">So this is a very interesting question. I started writing dynamic websites in 1998. Most developers don’t want to generate static sites. I think their reasons are more emotional than technical. About seven years ago I had two jobs - the day job was a high traffic retail fashion website. the side job was a very similar site, implemented as a static site that was recreated when content changed. The dynamic site had (first request) latencies of about 2 sec. The static site had typical latencies of 250ms. That’s almost 10x faster. It also cost about 2% of what the dynamic site cost to run.<div class=""><br class=""></div><div class=""> Sounds like you’re planning to do things the smart way. You haven’t said how busy your site is. Assuming that your hardware is Linux then your content will all be sitting in Linus’s page cache, so on a recent model server a well tuned Ng Inc can serve well over 100,000 requests per sec. the key is to use your browser cache whenever possible. As well as making good use if compute resources, a website like this is much more reliable than a dynamic site. There are few moving parts that can go wrong. Have fun!</div><div class=""><br class=""></div><div class="">Pete<br class=""><br class=""><div dir="ltr" class="">Sent from my iPhone</div><div dir="ltr" class=""><br class="">On Nov 2, 2018, at 1:18 AM, yf chu <<a href="mailto:cyflhn@163.com" class="">cyflhn@163.com</a>> wrote:<br class=""><br class=""></div><blockquote type="cite" class=""><div dir="ltr" class=""><div style="line-height: 1.7; font-size: 14px; font-family: Arial;" class=""><p class="MsoPlainText"><span lang="EN-US" class="">I have a website with tens of millions of pages.
The content on the page stored in database but the data is not changed very
frequently. so for the sake of improving the performance of the website and
reducing the costs of deployment of web applications, I want to generate the
static pages for the dynamic content and refresh the pages if the contents are
changed. But I am very concerned about how to manage these large amount of
pages. how should I store these pages? I plan to use Nginx to
manage these pages. Is it possible that it will cause IO problems when the web
server handle many requests? What is the capability of handing requests for Nginx ? Is there any better solutions for this issue? <o:p class=""></o:p></span></p></div><br class=""><br class=""><span title="neteasefooter" class=""><div class=""> <br class="webkit-block-placeholder"></div></span></div></blockquote><blockquote type="cite" class=""><div dir="ltr" class=""><span class="">_______________________________________________</span><br class=""><span class="">nginx mailing list</span><br class=""><span class=""><a href="mailto:nginx@nginx.org" class="">nginx@nginx.org</a></span><br class=""><span class=""><a href="http://mailman.nginx.org/mailman/listinfo/nginx" class="">http://mailman.nginx.org/mailman/listinfo/nginx</a></span></div></blockquote></div></div></div></blockquote></div><br class=""><br class=""><span title="neteasefooter" class=""><div class=""> <br class="webkit-block-placeholder"></div></span></div></blockquote></div><br class=""></div></body></html>