Problems with simultaneous webpage access by multiple users

Source: Internet
Author: User

A problem occurs when multiple users access the page at the same time, as if they were out of memory.
In addition, if you have experience with large websites, please talk about the precautions.
No error occurs when a single user runs.
An error occurs when multiple users exist.
For example, what should I pay attention to when writing code for database queries with large data volumes.

The latest problems are as follows:
When multiple users click a page at the same time, the error message in the log is as follows:

15:08:09 error [http-8080-Processor13] (applicationdispatcher. Java/704)-servlet. Service () for servlet JSP threw exception
Javax. servlet. jsp. jspexception: cannot find Bean: "list" in any scope
At org. Apache. Struts. taglib. tagutils. Lookup (tagutils. Java: 935)
At org. Apache. Struts. taglib. Logic. iteratetag. dostarttag (iteratetag. Java: 232)
At org. Apache. jsp. jsp. qans. admin. Tiles. quickanswerhtmlbody_jsp. _ jspservice (quickanswerhtmlbody_jsp.java: 382)
At org. Apache. Jasper. runtime. httpjspbase. Service (httpjspbase. Java: 97)
At javax. servlet. http. httpservlet. Service (httpservlet. Java: 802)
At org. Apache. Jasper. servlet. jspservletwrapper. Service (jspservletwrapper. Java: 332)
At org. Apache. Jasper. servlet. jspservlet. servicejspfile (jspservlet. Java: 314)
At org. Apache. Jasper. servlet. jspservlet. Service (jspservlet. Java: 264)
At javax. servlet. http. httpservlet. Service (httpservlet. Java: 802)
At org. Apache. Catalina. Core. applicationfilterchain. internaldofilter (applicationfilterchain. Java: 252)
At org. Apache. Catalina. Core. applicationfilterchain. dofilter (applicationfilterchain. Java: 173)
At org. Apache. Catalina. Core. applicationdispatcher. Invoke (applicationdispatcher. Java: 672)
At org. Apache. Catalina. Core. applicationdispatcher. doinclude (applicationdispatcher. Java: 574)
At org. Apache. Catalina. Core. applicationdispatcher. Include (applicationdispatcher. Java: 499)
At org. Apache. Jasper. runtime. jspruntimelibrary. Include (jspruntimelibrary. Java: 966)
At org. Apache. Jasper. runtime. pagecontextimpl. Include (pagecontextimpl. Java: 614)
At org. Apache. Struts. Tiles. tilesutilimpl. doinclude (tilesutilimpl. Java: 99)
At org. Apache. Struts. Tiles. tilesutil. doinclude (tilesutil. Java: 135)
At org. Apache. Struts. taglib. Tiles. inserttag. doinclude (inserttag. Java: 760)
At org. Apache. Struts. taglib. Tiles. inserttag $ inserthandler. doendtag (inserttag. Java: 892)
At org. Apache. Struts. taglib. Tiles. inserttag. doendtag (inserttag. Java: 462)
At org. Apache. jsp. jsp. Tiles. admin. layouts. mainlayout_jsp. _ jspx_meth_tiles_insert_1 (mainlayout_jsp.java: 278)
At org. Apache. jsp. jsp. Tiles. admin. layouts. mainlayout_jsp. _ jspservice (mainlayout_jsp.java: 146)
At org. Apache. Jasper. runtime. httpjspbase. Service (httpjspbase. Java: 97)
At javax. servlet. http. httpservlet. Service (httpservlet. Java: 802)
At org. Apache. Jasper. servlet. jspservletwrapper. Service (jspservletwrapper. Java: 332)
At org. Apache. Jasper. servlet. jspservlet. servicejspfile (jspservlet. Java: 314)
At org. Apache. Jasper. servlet. jspservlet. Service (jspservlet. Java: 264)
At javax. servlet. http. httpservlet. Service (httpservlet. Java: 802)
At org. Apache. Catalina. Core. applicationfilterchain. internaldofilter (applicationfilterchain. Java: 252)
At org. Apache. Catalina. Core. applicationfilterchain. dofilter (applicationfilterchain. Java: 173)
At org. Apache. Catalina. Core. applicationdispatcher. Invoke (applicationdispatcher. Java: 672)
At org. Apache. Catalina. Core. applicationdispatcher. doinclude (applicationdispatcher. Java: 574)
At org. Apache. Catalina. Core. applicationdispatcher. Include (applicationdispatcher. Java: 499)
At org. Apache. Jasper. runtime. jspruntimelibrary. Include (jspruntimelibrary. Java: 966)
At org. Apache. Jasper. runtime. pagecontextimpl. Include (pagecontextimpl. Java: 614)
At org. Apache. Struts. Tiles. tilesutilimpl. doinclude (tilesutilimpl. Java: 99)
At org. Apache. Struts. Tiles. tilesutil. doinclude (tilesutil. Java: 135)
At org. Apache. Struts. taglib. Tiles. inserttag. doinclude (inserttag. Java: 760)
At org. Apache. Struts. taglib. Tiles. inserttag $ inserthandler. doendtag (inserttag. Java: 892)
At org. Apache. Struts. taglib. Tiles. inserttag. doendtag (inserttag. Java: 462)
At org. Apache. jsp. jsp. qans. admin. Main. quickanswerhtmlmain_jsp. _ jspx_meth_tiles_insert_0 (quickanswerhtmlmain_jsp.java: 146)
At org. Apache. jsp. jsp. qans. admin. Main. quickanswerhtmlmain_jsp. _ jspservice (quickanswerhtmlmain_jsp.java: 97)
At org. Apache. Jasper. runtime. httpjspbase. Service (httpjspbase. Java: 97)
At javax. servlet. http. httpservlet. Service (httpservlet. Java: 802)
At org. Apache. Jasper. servlet. jspservletwrapper. Service (jspservletwrapper. Java: 332)
At org. Apache. Jasper. servlet. jspservlet. servicejspfile (jspservlet. Java: 314)
At org. Apache. Jasper. servlet. jspservlet. Service (jspservlet. Java: 264)
At javax. servlet. http. httpservlet. Service (httpservlet. Java: 802)
At org. Apache. Catalina. Core. applicationfilterchain. internaldofilter (applicationfilterchain. Java: 252)
At org. Apache. Catalina. Core. applicationfilterchain. dofilter (applicationfilterchain. Java: 173)
At org. Apache. Catalina. Core. applicationdispatcher. Invoke (applicationdispatcher. Java: 672)
At org. Apache. Catalina. Core. applicationdispatcher. processrequest (applicationdispatcher. Java: 463)
At org. Apache. Catalina. Core. applicationdispatcher. doforward (applicationdispatcher. Java: 398)
At org. Apache. Catalina. Core. applicationdispatcher. Forward (applicationdispatcher. Java: 301)
At org. Apache. Struts. Action. requestprocessor. doforward (requestprocessor. Java: 1085)
At org. Apache. Struts. Tiles. tilesrequestprocessor. doforward (tilesrequestprocessor. Java: 263)
At org. Apache. Struts. Action. requestprocessor. processforwardconfig (requestprocessor. Java: 398)
At org. Apache. Struts. Tiles. tilesrequestprocessor. processforwardconfig (tilesrequestprocessor. Java: 318)
At org. Apache. Struts. Action. requestprocessor. Process (requestprocessor. Java: 241)
At org. Apache. Struts. Action. actionservlet. Process (actionservlet. Java: 1196)
At org. Apache. Struts. Action. actionservlet. dopost (actionservlet. Java: 432)
At JP. co. NEC. necst. ebiz. Base. ebizactionservlet. dopost (ebizactionservlet. Java: 124)
At javax. servlet. http. httpservlet. Service (httpservlet. Java: 709)
At javax. servlet. http. httpservlet. Service (httpservlet. Java: 802)
At org. Apache. Catalina. Core. applicationfilterchain. internaldofilter (applicationfilterchain. Java: 252)
At org. Apache. Catalina. Core. applicationfilterchain. dofilter (applicationfilterchain. Java: 173)
At org. Apache. Catalina. Core. standardwrappervalve. Invoke (standardwrappervalve. Java: 213)
At org. Apache. Catalina. Core. standardcontextvalve. Invoke (standardcontextvalve. Java: 178)
At org. Apache. Catalina. Core. standardhostvalve. Invoke (standardhostvalve. Java: 126)
At org. Apache. Catalina. Valves. errorreportvalve. Invoke (errorreportvalve. Java: 105)
At org. Apache. Catalina. Core. standardenginevalve. Invoke (standardenginevalve. Java: 107)
At org. Apache. Catalina. connector. coyoteadapter. Service (coyoteadapter. Java: 148)
At org. Apache. Coyote. http11.http11processor. Process (http11processor. Java: 869)
At org. Apache. Coyote. http11.http11baseprotocol $ http11connectionhandler. processconnection (http11baseprotocol. Java: 664)
At org.apache.tomcat.util.net. pooltcpendpoint. processsocket (pooltcpendpoint. Java: 527)
At org.apache.tomcat.util.net. leaderfollowerworkerthread. Runit (leaderfollowerworkerthread. Java: 80)
At org. Apache. tomcat. util. threads. threadpool $ controlrunnable. Run (threadpool. Java: 684)
At java. Lang. thread. Run (thread. Java: 595)
15:08:09 error [http-8080-Processor13] (inserttag. java/922)-servletexception in '/JSP/qans/admin/tiles/quickanswerhtmlbody. JSP ': cannot find Bean: "list" in any scope
Org. Apache. Jasper. jasperexception: exception in JSP:/JSP/qans/admin/tiles/quickanswerhtmlbody. jsp: 188

185: <Div align = "right">
186: <input type = "button" class = "BTN" value = "& #12539; & #65405; & #65415; success & #12539; & #65405; & #12539; & #65405; & #12539; & #65405; "onclick =" using rcept: append (); "/>
187: </div>
188: <logic: iterate name = "list" id = "list">
189: <a href = "#" onclick = "javascript: _ sortidonclick ('<Bean: write name =" list "property =" chapterid "/> '); "> <Bean: Write property =" txtchaptertitle "name =" list "/> & nbsp; </a>
190:
191: <input type = "button" class = "BTN" value = "& #12539; & #65405; success & #12539; onclick =" javascript: deleted ('<Bean: write name = "list" property = "chapterid"/>'); "/>

If you are using a MySQL database and using connectorj for JDBC driver, pay special attention to the following questions:
When performing a database query, you must use appropriate conditions (or use limit) to minimize the result set size. For example, if you want to display 20 query results on a page, you need to use limit to restrict only 20 records in the result set. Do not impose any restrictions, and then use Rs. Next () to retrieve the first 20, and then ignore it. If you do this, although the results seem to be similar, the JDBC driver actually writes all the records in the result set to the memory when you get the first record, it's easy to get out of memory.
It is actually a thread security issue.
For example, I define a global variable in action,
There may be problems when many people access the page.
We hope that you will never use the global volume when developing it.

1. Database Connection Pool
2. The memory usage of uploaded files is too large. We recommend that you use time in exchange for space (parsing form fields)
3. Use js to relieve server load
4. For large fields, we recommend that you do not directly write them to the memory when opening the stream.
5 do not use Union for database queries
6. Increase the Web Container memory.
I have always been Tomcat + IIS. By default, Tomcat is 64 MB of memory, and the out of memory error is often reported. It is enough to increase it to MB.
7. Multi-Purpose preprocessing

Additional instructions:
The framework is:
Spring + hibernate + structs
Program problems Memory leakage many causes of this situation, such as database connection not closed, too much data read into memory at a time (such as select * from Table) or infinite Object Creation

If the program is normal, the memory overflow is caused by a large amount of data. batch query can be used to query large batches of data. Do not select all data at a time. You can perform batch queries by page.

Servlet. Service () for servlet JSP threw exception
Javax. servlet. jsp. jspexception: cannot find Bean: "list" in any scope
At org. Apache. Struts. taglib. tagutils. Lookup (tagutils. Java: 935)
At org. Apache. Struts. taglib. Logic. iteratetag. dostarttag (iteratetag. Java: 232)
At org. Apache. jsp. jsp. qans. admin. Tiles. quickanswerhtmlbody_jsp. _ jspservice

This is because the attribute value you put in a certain range of application, session, requset, and page does not have
Check whether the sendridrect () or the place where your property is stored is used for page Jump.

Cache Overflow
It is estimated that the page data volume is too large.

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.