存档

‘David Zhao’ 分类的存档

Berkeley DB 批量插入更新与删除用法示例

2010年3月1日 davidzhao 7 条评论

在Berkeley DB 4.8之前,我们可以执行的唯一的批量数据库操作是批量读取。
从Berkeley DB 4.8开始,Berkeley DB支持批量插入/更新/删除,并且用法也与批量读取相似。
批量插入/更新/删除对Berkeley DB的更新性能提升非常大,是一个值得认真学习的新功能。
本文就以一个示例程序展示批量插入和批量删除的用法。
阅读全文…

分类: Berkeley DB, David Zhao 标签:

Berkeley DB Java Edition Resources

2010年2月24日 chaohuang 评论已被关闭

Resources

  • The Berkeley DB Java Edition FAQ has useful tips and should be a first stop when trouble shooting problems.
  • You can find product information, datasheets, and whitepapers on the JE home page on OTN.
  • All JE release images are on the JE download page.
  • The JE documentation page has Javadoc, Getting Started Guides and tutorials.
  • Here is the JE License.
  • Charles Lamb, a JE developer, blogs about usage tips, announcements, and developer anecdotes.
  • There’s a whitepaper called Performing Queries in Oracle Berkeley DB Java Edition. The whitepaper takes common SQL queries and shows how to execute the same logic using the Direct Persistence Layer (DPL). The goal is to give users who are familiar with SQL some help in learning how to use the DPL.
  • Chinese language JE blogs are available at www.bdbchina.com
  • Application source code examples are included as part of the Berkeley DB JE distribution in the examples directory.
分类: Berkeley DB JE, David Zhao 标签:

Thread Local Storage Platform Issues and Dbstl’s Solutions

2009年12月16日 davidzhao 评论已被关闭

1. Overview

Thread local storage(tls) is a feature provided by most modern operating
systems(OS) that allow multiple threads within a process to have its own “global”
data, but the scope of the “global” data is restricted within a thread
itself, i.e. tls variables are thread wide global variables.

TLS can be useful if we want to store global data which are grouped by
threads, each thread only accesses its own piece of data, and have no loss of
concurrency. Without tls, we would have to store such data in a global data
structure (process wide) and use locks to sychronize access to it.

阅读全文…

分类: Berkeley DB, David Zhao, 程序设计 标签:

Berkeley DB示例程序详解(3.1)

2009年10月4日 davidzhao 12 条评论

/*
 * 这个示例程序演示了使用Berkeley DB的replication功能的方法。
 *
 * Berkeley DB提供了一套基本API和一套replication manager API来使用
 * 它的replication功能。
 * 前者有更大的灵活性,用户可以选择各种网络协议来实现数据传输,并且使用各种
 * 线程库来进行多线程编程。同时由于使用最基本的API, 用户可以定制选举和
 * replication系统的内部消息处理方式,非常灵活。所以这也意味着用户需要更多
 * 的代码来使用Berkeley DB replication功能,开发难度相对后者较大;
 * 后者基于TCP/IP协议和pthread线程库(Windows上面使用win32线程库),并且按照通常
 * 的需求,对选举和内部消息处理进行了通用的处理,并且通过让用户配置
 * 策略(policy)和参数的方式提供一定的灵活性和可定制性。
 *
 * 本程序基于Berkeley DB的replication manager。
 * 阅读全文…

分类: Berkeley DB, David Zhao 标签: ,

Berkeley DB示例程序详解(3.2)

2009年10月4日 davidzhao 评论已被关闭

接上篇:Berkeley DB示例程序详解(3.1)
/*
* Perform command line parsing and common replication setup for the repmgr
* and base replication example programs.
*/
int
common_rep_setup(dbenv, argc, argv, setup_info)
DB_ENV *dbenv;
int argc;
char *argv[];
SETUP_DATA *setup_info; 阅读全文…

分类: Berkeley DB, David Zhao 标签: ,

Berkeley DB 4.8 的 dbstl API

2009年9月30日 davidzhao 14 条评论

Berkeley DB 4.8 刚刚发布,我的心情格外激动。不仅仅是因为这个版本
是Berkeley DB新增了很多新功能,在很多方面有不小的增强,更因为在
众多的新功能中,有主要由我设计开发的STL API。 作为增强Berkeley DB的
易用性或者叫做用户友好性的重要组成部分,STL API是Berkeley DB4.8
的主要的新特性之一。
阅读全文…

分类: Berkeley DB, David Zhao 标签:

An Example of Mercurial Being a Distributed Version Control System

2009年7月30日 davidzhao 评论已被关闭

We internally use mercurial as the source version control system.
Mercurial is a very useful and powerful source control system, the difference
from cvs/svn is that, mercurial is a distributed source control system, see
its official doc for more information about this feature. 阅读全文…

分类: Berkeley DB, David Zhao 标签:

完全使用Linux工作

2009年7月10日 davidzhao 4 条评论

工作后很久以来,我一直在Linux环境下工作,除了偶尔的需要在Windows 上面使用MSVC编译运行一些测试和示例程序之外。不过我是在Windows XP上面使用cygwin来模拟Linux环境的,外加ssh到一个Linux服务器做一部分工作。Cygwin几乎可以完全地模拟Linux环境,但是偶尔还是会感到不方便。而我之前没有在laptop上面安装和使用 Linux是因为我偶尔需要使用qq,以及有些网站不用IE无法正确地使用。 阅读全文…

分类: David Zhao, 生活圆桌 标签:

Berkeley DB Performance Test

2009年7月10日 davidzhao 4 条评论

各位读者,很抱歉这篇文章是英文的,我当初做笔记的时候,写成英文了,这样才可以在同事之间交流。而现在确实没时间翻译过来了,还望大家理解,谢谢!

In this article I’d like to talk about the caveats and how-to’s when doing performance test with Berkeley DB, when the data volume is huge. For legal reasons I can not publish the result of my test without further approval, so I decided not to do so.

I. Context

I need to insert 10 billion key/data pairs to a btree database, each key item is 768 bytes, with no duplicate keys, and keys are inserted increasing only; each data item varies between KB/2 to 1KB. Thus each key/data pair varies between 1.25KB to 2KB.

阅读全文…

gcc4.4 issues

2009年7月10日 davidzhao 评论已被关闭

各位读者,很抱歉这篇文章是英文的,我当初做笔记的时候,写成英文了,这样才可以在同事之间交流。 而现在确实没时间翻译过来了,还望大家理解,谢谢!

If your code builds well using gcc4.3 and below, it may not build with gcc4.4, which was released in April 2009.

Following are some of the changes that violates c/c++ standard:

1. gcc4.4 does not by default #include stdio.h, or stdlib.h, no header files are by default included, all header files of standard c/c++ libraries need to be explicitly included.

阅读全文…

Դ