Day: June 3, 2009

  • Varnish vs Nginx

    Fedora 10 release note 提及 Varnish,据说“Varnish 是一个高性能 HTTP 加速器”,又看了一些其他网站的介绍,据说比 squid 快了好几倍。squid 是什么?没听说过。但既然同是反向代理服务器,Varnish 和 Nginx 相比如何?

    我没实测,但引用别人的测试结论:

    • 根据 Connection Times 获知 Varnish 连接速度快于 Nginx,但 Nginx 处理速度快于 Varnish,等待时间几乎一致,总时间 Nginx 要快于 Varnish 15%左右。
    • 根据 HTML transferred 项获知大负载下 Varnish存在较多的丢包问题。

    我想我还是坚持走 Nginx,并走好它。

  • recordset.clone is not working

    我修改了一段以前写的 vba,用到了 recordset.clone,没想到由于 vba 本身的 bug,克隆并没有进行,recordset.clone 返回值仍然是原记录集的引用。我在返回值记录集进行了 recordset.delete,结果把我原本想保持不动的原记录集里的记录给删了。

    那个恨啊!实在没想到 recordset.clone 只引用不克隆,害我为恢复原记录折腾了很久。我没兴趣深究原因,就当是 vba bug,就算是我调用参数配置不当,recordset.clone 克隆不成功也不能随随便便返回一个值而不抛出错误。

    既然 recordset.clone 不能用,找了一个前辈 Robert Gelb 写的函数来做真正的克隆。

    Public Function Clone(ByVal oRs As ADODB.Recordset, _
        Optional ByVal LockType As ADODB.LockTypeEnum = adLockUnspecified) As ADODB.Recordset
    
        Dim oStream As ADODB.Stream
        Dim oRsClone As ADODB.Recordset
    
        'save the recordset to the stream object
        Set oStream = New ADODB.Stream
        oRs.Save oStream
    
        'and now open the stream object into a new recordset
        Set oRsClone = New ADODB.Recordset
        oRsClone.Open oStream, , , LockType
    
        'return the cloned recordset
        Set Clone = oRsClone
    
        'release the reference
        Set oRsClone = Nothing
    End Function