不一样的思想~~ http://shop34712791.taobao.com MSN:wins0910@hotmail.com

发布新日志

  • php 内存占用(问/答)

    2008-03-25 22:44:38

    问:
    变量创建  class 使用 等 对内存的占用 情况如何?

    决定内存高占用的都有哪些因素?
    ______________________________________________________________________________________________
    答1:
    这和zend的引擎有关
    没研究过PHP这方面的代码
    帮你顶一下
    ______________________________________________________________________________________________
    答2:
    变量存储的数据是不是很大,如果是用完变量记得unset一下。
    数据库查询时候条件允许的化用一些专用函数,比如mysql_unbuffered_query,
    ______________________________________________________________________________________________
    答3:
    个人感觉对资源的消耗更多的是在服务器方面,像APACHE占用的资源.
    ______________________________________________________________________________________________
    答4:
    up 高手继续谈下经常验
    ______________________________________________________________________________________________
    答5:
    程序冗余代码多,内存就占用高。
    ______________________________________________________________________________________________
    答6:
    内存的管理由操作系统进行,php通过c函数alloc向操作系统申请内存空间。注意这个申请是申请一块连续的空间,若申请不到则php将不断的发出申请直到申请成功。你最好在服务器上安装内存整理软件来回收闲散的内存碎片。
    php向系统申请的空间不会超过php.ini中memory_limit的设置,该空间包括php进(线)程
    php向系统申请的空间在php进(线)程结束时将自动释放,但有未关闭的数据库连接时,这一动作将延迟一段时间。

    ______________________________________________________________________________________________
    答7:
    如果其中涉及到共享内存的情况的话 考虑到unix/windows系统,情况是不一样的
    ______________________________________________________________________________________________
    答8:
    多用户访问 时 这时的内存使用是怎样的呢?
    如: 1000 个用户同时访问    
    程序中的 $var = values;
    是每个用户都创建一次 单独占用一块内存    还是共享使用?

    在程序结整时 会自动释放这些内存的占用?    还是需要自己unset 他们?
    ______________________________________________________________________________________________
    答9:
    不是已经说了吗?每个连接独占不大于memory_limit的内存,用完后有php释放。自己unset可以减少向系统请求的空间,但作用不大
    ____________________________________________________________________________________

  • 还是碎片

    2007-10-27 13:42:49

    事务是在脚本中定义的某个操作,而点击是在测试中产生的http请求。

    例如,我定义了一个提交form的事务,我关心的也就是这个提交操作的数量与分值及响应时间的关系。而实际上这个form提交可能产生多个http请求。首先提交form本身有一次http请求,如果此请求被服务器端接受,则要转向到结果页面的第一个页面,又是一次http请求,如果这个页面中含有图片的话,那么每个图片都需要通过一个http连接来下载。

    所以:

    平均每个事务产生的点击数

     = 事务的数量+事务的数量×事务成功概率+事务的数量×事务成功概率×平均每个页面中含有的图片数

     = 事务的数量×(1+平均事务成功概率×(1+平均每个页面含有的图片数))

    ---

    tcpdump host -w sms.cap 218.80.253.xxa and \(218.80.253.xxb\) -i eth1 -s 0

    ---

    exp gdtoa/buddygdtoa full=y file=gdtoa.dmp
    scp *.dmp useraccount@xx.xx.xx.xx:/home/buddyv20

    ---

    ALTER SESSION SET nls_date_format = 'YYYY-MM-DD hh24:mi:ss';

    ---

     

     

     

  • 欢迎扔砖头~~~

    2007-08-06 16:43:16

    我在具体实践中借鉴了很多觉得比较有用的测试经验,这里面也有自己的一些想法。

    同时也希望能与大家共同探讨。

  • 错误代码

    2007-08-02 00:02:33

    4.400 Invalid syntax. 语法问题
    401 Access denied. 访问拒绝
    402 Payment required. 必须完整
    403 Request forbidden. 请求被禁止
    404 Object not found. 对象没有找到
    405 Method is not allowed. 方法不允许
    406 No response acceptable to client found. 客户端没有响应
    407 Proxy authentication required. 代理需要验证
    408 Server timed out waiting for request. 等等请求时服务器断开连接
    409 User should resubmit with more info. 有冲突用户应该进行检查
    410 Resource is no longer available. 资源不可用
    411 Server refused to accept request without a length. 服务器拒绝接受没有长度的请求
    412 Precondition given in request failed. 放弃请求失败的条件
    413 Request entity was too large. 请求太大
    414 Request Uniform Resource Identifier (URI) too long. 请求的URI 太长
    415 Unsupported media type. 不支持MEDIA类型
    449 Retry after doing the appropriate action. 在作了适当动作后重试
    500 Internal server error. 服务器内部错误
    501 Server does not support the functionality required to fulfill the request. 服务器不支持请求的功能
    502 Error response received from gateway. 从网关收到错误应答
    503 Temporarily overloaded. 过载
    504 Timed out waiting for gateway. 等待网关时请求断开
    505 HTTP version not supported. 不支持HTTP的版本

    HTTP status codes returned by servers on the Internet.
    从Internet返回的HTTP status代码(HTTP 状态字)
    HTTP_STATUS_CONTINUE (100)
    The request can be continued.
    请求不能被继续
    HTTP_STATUS_SWITCH_PROTOCOLS (101)
    The server has switched protocols in an upgrade header.
    通过新的header服务器的协议被转换了
    HTTP_STATUS_OK (200)
    The request completed successfully.
    请求成功的完成
    HTTP_STATUS_CREATED (201)
    The request has been fulfilled and resulted in the creation of a new resource.
    通过新的资源请求已经被完成
    HTTP_STATUS_ACCEPTED (202)
    The request has been accepted for processing, but the processing has not been completed.
    请求已经被接受处理,但是处理还没有完成
    HTTP_STATUS_PARTIAL (203)
    The returned meta information in the entity-header is not the definitive set available from the origin server.
    从服务器返回的在entity-header中的meta信息是无效的
    HTTP_STATUS_NO_CONTENT (204)
    The server has fulfilled the request, but there is no new information to send back.
    服务器实现了请求,但是没有返回信息
    HTTP_STATUS_RESET_CONTENT (205)
    The request has been completed, and the client program should reset the document view that caused the request to be sent to allow the user to easily initiate another input action.
    请求已经被完成,并且web程序(客户端程序浏览器程序)已经重置了文档视图目录(content),这个目录很容易允许使用者用另一个动作发送请求
    HTTP_STATUS_PARTIAL_CONTENT (206)
    The server has fulfilled the partial GET request for the resource.
    服务器已经为资源完成了部分GET请求
    HTTP_STATUS_AMBIGUOUS (300)
    The server couldn't decide what to return.
    服务器不能判定返回什么
    HTTP_STATUS_MOVED (301)
    The requested resource has been assigned to a new permanent URI (Uniform Resource Identifier), and any future references to this resource should be done using one of the returned URIs.
    被请求的资源已经被分配给新的URI,并且以后引用时都使用这个URIs资源。
    HTTP_STATUS_REDIRECT (302)
    The requested resource resides temporarily under a different URI (Uniform Resource Identifier).
    请求的资源临时在不同的uri下
    HTTP_STATUS_REDIRECT_METHOD (303)
    The response to the request can be found under a different URI (Uniform Resource Identifier) and should be retrieved using a GET HTTP verb on that resource.
    请求的资源不能在不同的uri下找到,并且从新使用GET HTTP在服务器上从新检索
    HTTP_STATUS_NOT_MODIFIED (304)
    The requested resource has not been modified.
    请求的资源没有被改变
    HTTP_STATUS_USE_PROXY (305)
    The requested resource must be accessed through the proxy given by the location field.
    请求的资源必须通过特定的代理获得
    HTTP_STATUS_REDIRECT_KEEP_VERB (307)
    The redirected request keeps the same HTTP verb. HTTP/1.1 behavīor.
    从定位请求,
    HTTP_STATUS_BAD_REQUEST (400)
    The request could not be processed by the server due to invalid syntax.
    因为语法不能被服务器处理
    HTTP_STATUS_DENIED (401)
    The requested resource requires user authentication.
    请求资源命令必须被验证(拒绝访问)
    HTTP_STATUS_PAYMENT_REQ (402)
    Not currently implemented in the HTTP protocol.
    没有完全实现HTTP协议
    HTTP_STATUS_FORBIDDEN (403)
    The server understood the request, but is refusing to fulfill it.
    服务器理解了请求,但是拒绝完成他
    HTTP_STATUS_NOT_FOUND (404)
    The server has not found anything matching the requested URI (Uniform Resource Identifier).
    没有找到任何被指定的URI

    HTTP_STATUS_BAD_METHOD (405)
    The HTTP verb used is not allowed.
    Http动作不被允许
    HTTP_STATUS_NONE_ACCEPTABLE (406)
    No responses acceptable to the client were found.
    应答没有被客户接受
    HTTP_STATUS_PROXY_AUTH_REQ (407)
    Proxy authentication required.
    代理必须被验证
    HTTP_STATUS_REQUEST_TIMEOUT (408)
    The server timed out waiting for the request.
    服务器在等待请求时中止了
    HTTP_STATUS_CONFLICT (409)
    The request could not be completed due to a conflict with the current state of the resource. The user should resubmit with more information.
    请求不能被完成,问题是资源冲突。用户应该进行调整
    HTTP_STATUS_GONE (410)
    The requested resource is no longer available at the server, and no forwarding address is known.
    请求的资源在服务器上不再可用,而且没有转发地址
    HTTP_STATUS_LENGTH_REQUIRED (411)
    The server refuses to accept the request without a defined content length.
    服务器拒绝接受没有定义目录大小的请求
    HTTP_STATUS_PRECOND_FAILED (412)
    The precondition given in one or more of the request header fields evaluated to false when it was tested on the server.
    当在服务器上测试请求头文件放弃一个或者多个请求的条件
    HTTP_STATUS_REQUEST_TOO_LARGE (413)
    The server is refusing to process a request because the request entity is larger than the server is willing or able to process.
    服务器拒绝处理请求,原因是请求的大小超过服务器能够处理的大小
    HTTP_STATUS_URI_TOO_LONG (414)
    The server is refusing to service the request because the request URI (Uniform Resource Identifier) is longer than the server is willing to interpret.
    服务器拒绝服务,原因是请求的URI超过了服务器能够揭示的长度
    HTTP_STATUS_UNSUPPORTED_MEDIA (415)
    The server is refusing to service the request because the entity of the request is in a format not supported by the requested resource for the requested method.
    服务器拒绝服务,原因是请求格式不被支持
    HTTP_STATUS_RETRY_WITH (449)
    The request should be retried after doing the appropriate action.
    在作了适当的动作后请求被重试
    HTTP_STATUS_SERVER_ERROR (500)
    The server encountered an unexpected condition that prevented it from fulfilling the request.
    服务器遇到请求失败意外
    HTTP_STATUS_NOT_SUPPORTED (501)
    The server does not support the functionality required to fulfill the request.
    服务器不支持必须完成请求的功能
    HTTP_STATUS_BAD_GATEWAY (502)
    The server, while acting as a gateway or proxy, received an invalid response from the upstream server it accessed in attempting to fulfill the request.
    服务器当作为网关或代理时,从上行服务器接受的响应请求失败
    HTTP_STATUS_SERVICE_UNAVAIL (503)
    The service is temporarily overloaded.
    服务器负载
    HTTP_STATUS_GATEWAY_TIMEOUT (504)
    The request was timed out waiting for a gateway.
    等待网关时请求断开,没有响应
    HTTP_STATUS_VERSION_NOT_SUP (505)
    The server does not support, or refuses to support, the HTTP protocol version that was used in the request message.
    服务器不支持或者拒绝支持正在使用请求的HTTP协议的版本

  • 记忆的碎片-汇总

    2007-08-02 00:01:24

    1、报错:Server redirected too many  times (20)

    查了很多资料,怀疑是jdk1.5的bug
    程序背景:通过http协议走的ws请求。重定向是http协议支持的标准。
    jdk1.3中有描述解决 redirects =5的问题,且重定向个数在1.4版本中运用没问题。

    提示:重定向太多次(20)
    后来发现:去掉代码里的代理服务器设置就好了。

    2、java.net.SocketException: No buffer space available (maximum connections reached?): recv failed
     at java.net.SocketInputStream.socketRead0(Native Method)
     at java.net.SocketInputStream.read(Unknown Source)
     at java.io.BufferedInputStream.fill(Unknown Source)
     at java.io.BufferedInputStream.read1(Unknown Source)


    在多线程并发过程中,会报以上错误,怀疑是连接请求次数过多导致,同一请求至多3个线程同时处理能力。
    后来发现:
    去掉程序中的代理服务器代码即可。


    3、error_code : 407
       Proxy Authentication Required

       504:
       Gateway Timeout

    4、某些表执行速度很慢,相对相同的另一个库。
    执行计划中表分析的一些方法:
    ANALYZE TABLE T_IVR_BILL ESTIMATE STATISTICS SAMPLE 10 percent;

    5、内存溢出或内存缺报错:
    加入gc日志监控以及MaxPermSize大小:
    JAVA_OPTS="-XX:MaxPermSize=256m -Xloggc:./gclog.log -Xms256m -Xmx1024m

    http://www.matrix.org.cn/thread.shtml?topicId=37096&forumId=1
    62.708: [GC 94686K->11549K(325760K), 0.0383360 secs

    6、现象:

    1、基本在上传文件、提交等场景。
    2、并发压力比较大的话,2个小时后,tomcat报内存溢出。
    3、压力不大的前提下,场景持续运行时间较长,基本要3天以上。
    4、内存值明显增长,到2G后报错。
    5、tomcat+tapestry+oracle

    解决办法是:到应用里面的WEb-INF下的lib,更新2个jar包。
    commons-fileupload-1.1.1.jar
    commons-io-1.2.jar
    为最新版本

     

     

  • LR关联

    2007-08-01 11:11:32

    嗯,今天很平静,啥事都没想,没多想,顶多鼻子“哼哼”了几下,一下子过眼云烟咯。最主要的是,我解决了一个很棘手的问题,关于登录界面图片校验码的问题,前段时间解决的,但不同技术构架不同思路,却在.net下被难住了,倒不是那种语言的问题,可能涉及数字校验和图片校验的区别。。想一想,试一试,弄不出来了,就到处走一走,换些其它的活儿干,清静一会/转移思路,过段时间再捡回它吧。。我经常用这种方法搞定东西的,主要自己太刻薄,钻进去就钻不出来了。吼吼
    比较得意,摘抄如下,以后再专门开个类别存放,省得以后记忆力完蛋:
    ...
    lr_think_time( 13 );
    web_set_max_html_param_len("100000000");
    web_reg_save_param("validNum","LB=images/randImg/","RB=.gif","ORD=ALL",LAST);
    web_submit_form("sysuserLoginAction.do;jsessionid={WCSParam_Diff1}",
      "Snapshot=t2.inf",ITEMDATA,
      "Name=sysuserName", "Value=CTAdmin", ENDITEM,
      "Name=password", "Value=CTAdmin", ENDITEM,
      //"Name=validNum", "Value=1879", ENDITEM,
      "Name=validNum", "Value={validNum}", ENDITEM,
      "Name=Submit", "Value=登 录", ENDITEM,
    这里,session原来是被j2ee安全机制屏蔽了的,要是去掉j2ee安全检查,就看不到这块了(记住)
    另外:Execution Log里面是这样的:
    (源代码找不到了,暂时把思路写下来:)
    ...
    <input=...type="text"...><src = ....image.jsp>
    <img src=..../../randimage/3.gif><img src=../../../randimage/7.gif>...(一般一共四个随机图片)
    由image.jsp内部调用rand()函数处理得到.而数字的随机校验,据说是从服务器处生成随机数字后,传到客户端,因此实现机制不一样,不能从类似的getcode.jsp得到里面的img src.总之,原则是找到每次随机数的左右边界,然后关联其中的数值,即可。很简单,理解了逻辑思维就可以咯~不管怎样,大雁飞过一定要吼吼一下哈。
        咳咳
Open Toolbar