| 301 |
ashish |
1 |
// Copyright (c) 2007-2008 Facebook
|
|
|
2 |
//
|
|
|
3 |
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
4 |
// you may not use this file except in compliance with the License.
|
|
|
5 |
// You may obtain a copy of the License at
|
|
|
6 |
//
|
|
|
7 |
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
8 |
//
|
|
|
9 |
// Unless required by applicable law or agreed to in writing, software
|
|
|
10 |
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
11 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
12 |
// See the License for the specific language governing permissions and
|
|
|
13 |
// limitations under the License.
|
|
|
14 |
//
|
|
|
15 |
// See accompanying file LICENSE or visit the Scribe site at:
|
|
|
16 |
// http://developers.facebook.com/scribe/
|
|
|
17 |
|
|
|
18 |
Scribe tests
|
|
|
19 |
|
|
|
20 |
Test 0 is a step by step list of how to run scribe and do a simple stress test.
|
|
|
21 |
The rest of the tests assume you're pretty familiar with scribe, and you'll
|
|
|
22 |
need to edit test/tests.php to point test clients at the right place.
|
|
|
23 |
|
|
|
24 |
0) - set THRIFT_ROOT in tests.php to the location of the Thrift php library
|
|
|
25 |
(this is found in lib/php of your Thrift install)
|
|
|
26 |
- set SCRIBE_ROOT to the location of the genereated thrift interface for scribe
|
|
|
27 |
(by default this gets created in src/gen-php)
|
|
|
28 |
- mkdir /tmp/scribetest
|
|
|
29 |
- bin/scribed test/scribe.conf.test
|
|
|
30 |
this doesn't daemonize, so open another terminal and run:
|
|
|
31 |
- php test/many_connections.php
|
|
|
32 |
- test/resultChecker/resultChecker client1 /tmp/scribetest/scribe_test/scribe_test-*
|
|
|
33 |
|
|
|
34 |
1) strange inputs
|
|
|
35 |
- simple_test.php and verify that two messages show
|
|
|
36 |
up in the log. Look at the log with hexdump -C
|
|
|
37 |
and verify that one of the messages contains a zero byte.
|
|
|
38 |
- strange_input.php and verify that nothing crashes.
|
|
|
39 |
This tests very long messages and categories and
|
|
|
40 |
messages and categories with strange characters
|
|
|
41 |
|
|
|
42 |
2) bad configuration
|
|
|
43 |
- configure the following and check that status in fb303 is
|
|
|
44 |
useful and things start to work again when the config is fixed.
|
|
|
45 |
- unknown type
|
|
|
46 |
- numeric fields with letters
|
|
|
47 |
- directory not writable
|
|
|
48 |
- directory doesn't exist
|
|
|
49 |
- no stores configured
|
|
|
50 |
|
|
|
51 |
3) stress test
|
|
|
52 |
- configure the server for chunk_size=1024
|
|
|
53 |
- run stress_test.php from a couple of hosts simultaneously
|
|
|
54 |
using different client names
|
|
|
55 |
- run resultChecker for every client to verify all the
|
|
|
56 |
messages are stored on the central server in order.
|
|
|
57 |
- hexdump -C <logfile> | more
|
|
|
58 |
and verify that a message starts on every 1024 byte
|
|
|
59 |
boundary.
|
|
|
60 |
|
|
|
61 |
4) error handling
|
|
|
62 |
- start a central scribe server(ie bin/scribed test/scribe.conf.test)
|
|
|
63 |
- start a client scribe server(ie bin/scribed test/scribe.conf.test2)
|
|
|
64 |
- start the stress test
|
|
|
65 |
- stop and restart the central server
|
|
|
66 |
- verify all messages have been stored on the central
|
|
|
67 |
machine (a few messages could be missing if the server
|
|
|
68 |
was killed instead of shut down cleanly)
|
|
|
69 |
|
|
|
70 |
5) more error handling
|
|
|
71 |
- start scribe only on the client machine
|
|
|
72 |
- run the stress test
|
|
|
73 |
- stop scribe on the client machine
|
|
|
74 |
- start scribe on the central machine
|
|
|
75 |
- start scribe again on the client machine
|
|
|
76 |
- run the stress test again
|
|
|
77 |
- verify all messages are stored on the central machine
|
|
|
78 |
|
|
|
79 |
6) test different start order
|
|
|
80 |
- start client then central
|
|
|
81 |
- start central then client
|
|
|
82 |
|
|
|
83 |
7) many connections
|
|
|
84 |
- run many_connections.php from a few client machines,
|
|
|
85 |
specifying a different client name for each.
|
|
|
86 |
(this script has similar output to stress_test.php,
|
|
|
87 |
but it opens many connections directly to the
|
|
|
88 |
central server to simulate many server machines)
|
|
|
89 |
- use resultChecker to verify that all messages were
|
|
|
90 |
stored on the central server.
|
|
|
91 |
|
|
|
92 |
8) throttling and reconfig under load
|
|
|
93 |
- set max_msg_per_second on central server very low
|
|
|
94 |
- run stress test
|
|
|
95 |
- increase max_msg_per_second on central server
|
|
|
96 |
- reconfig both servers
|
|
|
97 |
|
|
|
98 |
9) test thread sharing mode
|
|
|
99 |
- repeat tests with new_thread_per_category=no
|
|
|
100 |
- start client but not central, run superstress.php
|
|
|
101 |
- next, start up central and wait for buffered messages to send
|
|
|
102 |
- use resultChecker to verify that all messages were
|
|
|
103 |
stored on the central server.
|
|
|
104 |
|
|
|
105 |
10) test creating a store with multiple 'categories' specified
|
|
|
106 |
- Eg: "categories=test1 test2 test3"
|
|
|
107 |
|
|
|
108 |
11) test bucketstore using buckettest.conf and bucket_test.php
|