A little bit more...

Sunday, March 04, 2007

服务器租借与托管资料收集

(本文仅仅为资料收集,不存在原创内容)

1. 名词解释

1U-4U:

U(英文中的Unit?不知道)代表架式服务器的高度,1U=1.75英寸=4.45厘米。同样的2U=4*1.75英寸=4*4.45厘米,以此类推。

机柜:

一般多个机架服务器安装在一个机柜内,一个普通机柜的高度是42U。

ICP:

ICP(Internet Content Provider)证的全称:《中华人民共和国电信与信息服务业务经营许可证》即ICP证,通过互联网向上网用户提供有偿信息、网上广告、代制作网页、电 子商务及其它网上应用服务的公司必须办理的网络经营许可证。国家对经营性网站实行ICP证制度,注册资金应在100万或者100万以上的公司才能办理 ICP证,一经办理一般能在该省的通信管理局的网站查询到。同时对从事非经营性活动的网站要进行ICP备案,简称为ICP备。

2. 服务器的种类

首先,我们必需了解何谓PC服务器?所谓PC服务器(下文讨论的多为PC服务器),即是Intel架构服务器,与一些大型服务器如 Mainframe, Unix架构服务器等不同,前者大多运行Windows或Linux等操作系统,使用较为普遍,后者多为专业用途,如银行,大型制造业,物流业,证券…等 行业使用,一般人较少有机会接触到.

可以按照各种标准进行分类,按应用层次分为:入门级服务器、工作组级服务器、部门级服务器和企业级服务器;按处理器架构分为:CISC (Complex Instruction Set Computer)架构服务器、RISC(Reduced Instruction Set Computing)架构服务器和VLIW(Very Long Instruction Word超长指令集架构)架构服务器;按用途分为:通用型服务器和专用型服务器,或者WEB服务器、E-mail服务器、数据服务器、DNS服务器等等; 按机箱结构分为:台式(塔式)服务器、机架服务器、机柜服务器和刀片式(bladed)服务器。

2.1 塔式服务器

优点:服务器的主板扩展性较强、插槽也多,可以进行硬盘和电源的冗余扩展,对环境要求较低,原则上不用和机柜搭配使用,价格也相对较低,集多种常见的服务和应用于一身。

缺点:塔式服务器长得跟我们平时用的台式机一样,占用空间比较大,适合小型企业自己维护,不适合放在服务器托管商那里托管,独立性太强,协同工作在空间占用和系统管理上都不方便,在一些应用要求较高的企业中,这种单机服务器无法满足要求。

2.2 机架服务器

机架式(RACK)服务器长得像卧着的台式机,可以一台一台地放到固定机架上,因此而得名。机架服务器一般采用标准19英寸的宽度设计,其高度按照一定的单位高度的设计,其单位为U,约为4.54cm。

优点:机架是服务器的机箱宽度都是相同的,可以在标准的机柜中存放服务器,减少服务器产品对空间的要求,易于服务器的集中管理。所以机架服务器便于放在服务器托管商那里托管。

缺点: 购买价格相对较高,比同等配置的塔式服务器价格要高20%-30%,1U以上服务器服务器托管费用较高。由于在空间上非常紧凑,所以在扩展性和散热方面上具有一定限制,一般无法实现太完整的设备扩展,所以单机性能相对比较有限。

2.3 刀片式服务器

3. 服务器的购买和租借

一般服务器或者自行购买然后放到IDC(Internet Data Center)服务提供商的机房托管,或者租借IDC服务商的。租借的服务器一般IDC服务提供商都会负责托管,租借又分为送产权和不送产权两种,送产权 的即租用一定时间(如1年或者2年)后服务器的产权归用户。需要指出的是租用的服务器大多数不是新的服务器,而是旧的组装服务器,当然也有宣称租用品牌服 务器的IDC服务商。

下面主要说说PC服务器的基本硬件配置常识。主要的服务器国际生产商有:IBM,HP,Dell,Sun(最近也推出X86服务器产品),超微等; 国内生产商主要有:曙光、联想、浪潮、方正、清华同方、华硕等;服务器芯片生产商主要是:Intel和AMD;服务器芯片主要有:Pentium 4(单路)、Itanium(安腾,64位,Dual-Core)Xeon(至强,双路)、XeonMP(Multi Processing Platform,四路)、AthlonMP(速龙MP)、Opteron(皓龙,64位,100系列是单路,200系列是双路,800系列是四路和八 路)。

4. 托管服务器的流程

4.1 选择托管服务器的类型

购买全新服务器,或向服务器托管商租借。

4.2 选择服务器托管商

考察服务商、机房,最好能去现场考察,以检查其设施是否齐全。

4.3 签订托管合同

如果是自己购买的服务器,则需要运送服务器到托管商指定的机房,最后签订详细的托管合同。

5. 经验

5.1 最好不要异地托管

如果是自己购买的服务器最好不要找异地托管,因为时候要对服务器进行本地维护。

5.2 带宽保证

不管是独享带宽还是共享带宽,实际使用的带宽一般不会超过10M,甚至5M甚至更低,各地的IDC都会有限制。

5.3 ICP证

一定要检查托管商是否有ICP证。

6. 业界案例

豆瓣网,土豆网,劲舞团等等。

7. 上海的服务商简介

中国E动网www.edong.com

8. 其他

www.linkwan.com/vr ,用来测试机房速度和当前连接的路由节点。

参考资料:

  1. 首次托管服务器经验
  2. 服务器结构中的1U 2U 3U是什么意思?
  3. 机架式服务器和塔式服务器的区别
  4. 服务器有哪些种类?
  5. 典型用户案例
  6. 什么是机架式服务器?
  7. BananaSkin(持续关注IDC方面的博客)
  8. 服务器有关的Post(123)(豆瓣blog
  9. 如何挑选服务器?哪个牌子的最好?(1万元以下的)
  10. 关于”个人网站申请备案”经验
  11. 业内人士教您如何选择IDC
  12. 服务器托管—你会选1U还是2U服务器?
  13. ICP专栏:介绍ICP相关知识,ICP申请、ICP备案流程及所须资料等
  14. 【转载】教你如何租服务器和选择机房
  15. 差价缩小:现在你考虑1U还是2U?
  16. 中国IDC产业发展调查暨年度大典官方网站
  17. 找小说网正式拥有属于自己的服务器

Tuesday, January 30, 2007

AspectJ Syntax Notes and More…

Note: Some of the following items, especially items in red, are based on my experience with aspectj 1.5.3.200611221118 (AJDT 1.4.1.200611230655) , JVM 1.5.0-b64, and JDT 3.2.0.v20060609m-F7snq1fxia-Z4XP.

  • [Nested/Inner Aspect] Nested aspects must be static. An inner aspect has to be static, in order to get rid of the implicit “&& this()” which you get on a perthis-Aspect.
  • [Aspect Extension] aspects may only extend abstract aspects. It is an error for a concrete aspect to extend another concrete aspect.
  • [Aspect Instantiation] Because advice only runs in the context of an aspect instance, aspect instantiation indirectly controls when advice runs.
  • [Aspect Instantiation] The criteria used to determine how an aspect is instantiated is inherited from its parent aspect. If the aspect has no parent aspect, then by default the aspect is a singleton aspect.
  • [Aspect Instantiation] Static initialization occurs when the type is loaded (i.e., the Java VM
    loads the resulting class file for Lolo). At that point, the implementation of the before calls the static method aspectOf to access the singleton instance of Lolo.
  • [Aspect Instantiation] You can get a NoAspectBoundException when there is a cycle in aspect initialization or static initialization (within one aspect, or between a chain of several aspects), most commonly when an aspect advises its own initializer.
  • [Aspect Instantiation] During the constructor of an aspect, calling aspectOf() on that aspect would fail. Because at that moment, no aspect instance has been bound. It is the same reason why in an after() :(execution(AspectA.new())) advice, calling AspectA.aspectOf() would fail. In this case, instead, target can be used to expose the instance of AspectA.
  • [Aspect Instantiation] ! Do not advise join points in cflowbelow(execution(AspectA.new())), there are bugs or flaws with aspectj which your advice may reproduce, especially when dynamically determined variable are involved in your advice body. Or don’t define your own aspect constructor, but just use the default aspect constructor, which would make your aspectj code more robust.
  • [Advice Execution] ! Exception or Error thrown in advice “before(String[] args) : execution(public static void *.main(String[]))” can’t be captured!
  • [Declaration] ! How to declare an error if some join points that are supposed to be captured are actually not captured?
  • [PCD] A named pointcut may be defined in either a class or aspect, and is treated as a member of the class or aspect where it is found. As a member, it may have an access modifier such as public or private. Abstract pointcuts may only be declared within abstract aspects. For completeness, a pointcut with a declaration may be declared final. Though named pointcut declarations appear somewhat like method declarations, and can be overridden in subaspects, they cannot be overloaded.
  • [PCD] call(Foo.new(..)) can’t be used together with target(*).
  • [PCD] Rather than cflow, use lexical-structure based pointcuts, within or withincode, preferablely. It will make the cross-reference view of the AJDT more accurate and less time consuming.

to be continued…

Resources:

  1. aspectj doc
  2. aspectj-user-request mailing list

Saturday, January 20, 2007

DOM Level 3 Load and Save

1. Introduction

Defined by w3 consortium, just as its name indicates, it serves as interfaces to objects that dealing with loading and saving DOM objects.

It’s noteworthy that various specific implementations doesn’t always fully support.

With java, it is well supported, though, some optional specifications are not supported (at least not always workabe from my experience). However, for web developers, there’s a quote from a book for you:

Now that XMLHttpRequest is being standardized, it seems likely that LSParser will never be supported by most browsers.

In addition, with java, you can also selectively use javax.xml.transform to deal with loading and saving DOM objects.

2. Breakdown

Cite from org.w3c.dom.ls:

DOMImplementationLS
DOMImplementationLS contains the factory methods for creating Load and Save objects.

LSInput
This interface represents an input source for data.

LSLoadEvent
This interface represents a load event object that signals the completion of a document load.

LSOutput
This interface represents an output destination for data.

LSParser
An interface to an object that is able to build, or augment, a DOM tree from various input sources.

LSParserFilter
LSParserFilters provide applications the ability to examine nodes as they are being constructed while parsing.

LSProgressEvent
This interface represents a progress event object that notifies the application about progress as a document is parsed.

LSResourceResolver
LSResourceResolver provides a way for applications to redirect references to external resources.

LSSerializer
A LSSerializer provides an API for serializing (writing) a DOM document out into XML.

LSSerializerFilter
LSSerializerFilters provide applications the ability to examine nodes as they are being serialized and decide what nodes should be serialized or not.

3. Examples

a. Write an instance of Document to a file with org.w3c.dom.ls:

DOMImplementationLS domImpl = (DOMImplementationLS)doc
.getImplementation();
LSSerializer serializer = domImpl.createLSSerializer();
LSOutput output = domImpl.createLSOutput();
output.setCharacterStream(new PrintWriter(fileName));
serializer.write(doc, output);

b. Write an instance of Document to a file with javax.xml.transform:

StreamResult sr = new StreamResult(new File(fileName));
Transformer t = TransformerFactory.newInstance().newTransformer();
t.transform(new DOMSource(doc), sr);

Note: it seems, from my experience, that example b can’t preserve the print friendly presentation.

Resources:

  1. Document Object Model (DOM) Level 3 Core Specification Version 1.0
  2. Document Object Model (DOM) Level 3 Load and Save Specification Version 1.0
  3. DOM Level 3
  4. Java Impl. Package org.w3c.dom.ls (src, api spec)

Saturday, January 13, 2007

Feed Format — The Programmable Web

Resources:

Spec. Intro.

  1. What Is RSS
  2. Content feeds with RSS 2.0
  3. RSS 2.0 Specification
  4. The Atom Syndication Format
  5. OPML 1.0 Specification
  6. OPML 2.0 draft spec

Feed Reader Impl.

  1. A Java pen source reader: RSSOwl(bin, src)
  2. XML Processing With Java Overview
  3. Three ways of validating a xml document with Java
  4. Comment on W3C DOM and various implmentations in defferent PL
  5. Unicode, UTF等字符编码摘记
  6. Control a Web Browser From Within a Java Programm

Technorati : , , , , ,
Del.icio.us : , , , , ,

Control a Web Browser From Within a Java Programm

Noramlly, more than two way you can use a web browser with your Java programm.

1.Fire commands to invoke a web browser with Java runtime support.

// cmd = ‘rundll32 url.dll,FileProtocolHandler http://…’
cmd = WIN_PATH + ” ” + WIN_FLAG + ” ” + url;
Process p = Runtime.getRuntime().exec(cmd);

See the API Spec of Java for Process, and Java Tip 66 of the Resources section for more information.

2. Use a wrapped browser control

2.1 Use Jacob, the open source COM wrapper. e.g.,

protected void openIExplorer(){
comp = new ActiveXComponent( “InternetExplorer.Application” );
comp.setProperty( “Visible”, new Variant(true) );
comp.invoke( “Navigate”, new Variant[]{ new Variant((String)comboFilename.getSelectedItem()) } );

2.2 Use browser wrapper provided by SWT.

import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.browser.CloseWindowListener;
import org.eclipse.swt.browser.LocationAdapter;
import org.eclipse.swt.browser.LocationEvent;
import org.eclipse.swt.browser.OpenWindowListener;
import org.eclipse.swt.browser.ProgressEvent;
import org.eclipse.swt.browser.ProgressListener;
import org.eclipse.swt.browser.StatusTextEvent;
import org.eclipse.swt.browser.StatusTextListener;
import org.eclipse.swt.browser.VisibilityWindowAdapter;
import org.eclipse.swt.browser.WindowEvent;

3. or any other ways I havn’t figured out…

Resources:

  1. Java Tip 66: Control browsers from your Java application
  2. JavaTM 2 Platform Standard Edition 5.0 API Specification
  3. The JACOB Project: A JAva-COM Bridge
  4. SWT Browser
  5. Package org.eclipse.swt.browser
  6. Developer Forums java to invoke IExplore?

Technorati : , , , , , , ,
Del.icio.us : , , , , , , ,

About Me

My photo
I'm finishing my master degree in Software Engineering, Computer Science. I believe and have been following what Forrest Gump's Mam said: you have to do the best with what god gave you.