]> git.saurik.com Git - redis.git/commitdiff
new counter in INFO output: rejected_connections with number of dropped connections...
authorantirez <antirez@gmail.com>
Wed, 23 Nov 2011 17:38:12 +0000 (18:38 +0100)
committerantirez <antirez@gmail.com>
Wed, 23 Nov 2011 17:38:12 +0000 (18:38 +0100)
src/networking.c
src/redis.c
src/redis.h

index 537ebaba65a35286d6f09c4d9e515a1bf3dd8198..c9286195c3fa05d57a4a8a9002e4f67977b38c4f 100644 (file)
@@ -419,6 +419,7 @@ static void acceptCommonHandler(int fd) {
         if (write(c->fd,err,strlen(err)) == -1) {
             /* Nothing to do, Just to avoid the warning... */
         }
+        server.stat_rejected_conn++;
         freeClient(c);
         return;
     }
index 3db2f0f4f20759e9397269f267302d5fa7c98f36..a4eb508091bc0559368e9e40d6b5a6df382cd677 100644 (file)
@@ -1016,6 +1016,7 @@ void initServer() {
     server.stat_keyspace_hits = 0;
     server.stat_peak_memory = 0;
     server.stat_fork_time = 0;
+    server.stat_rejected_conn = 0;
     server.unixtime = time(NULL);
     aeCreateTimeEvent(server.el, 1, serverCron, NULL, NULL);
     if (server.ipfd > 0 && aeCreateFileEvent(server.el,server.ipfd,AE_READABLE,
@@ -1539,6 +1540,7 @@ sds genRedisInfoString(char *section) {
             "# Stats\r\n"
             "total_connections_received:%lld\r\n"
             "total_commands_processed:%lld\r\n"
+            "rejected_connections:%lld\r\n"
             "expired_keys:%lld\r\n"
             "evicted_keys:%lld\r\n"
             "keyspace_hits:%lld\r\n"
@@ -1548,6 +1550,7 @@ sds genRedisInfoString(char *section) {
             "latest_fork_usec:%lld\r\n",
             server.stat_numconnections,
             server.stat_numcommands,
+            server.stat_rejected_conn,
             server.stat_expiredkeys,
             server.stat_evictedkeys,
             server.stat_keyspace_hits,
index 40d0d39ab8239c748ecad8f8cb5223bd4af9266f..4a2f6e1e5f4d561a4fcb6942116f9f2051ef93e4 100644 (file)
@@ -527,6 +527,7 @@ struct redisServer {
     long long stat_keyspace_misses; /* number of failed lookups of keys */
     size_t stat_peak_memory;        /* max used memory record */
     long long stat_fork_time;       /* time needed to perform latets fork() */
+    long long stat_rejected_conn;   /* clients rejected because of maxclients */
     list *slowlog;
     long long slowlog_entry_id;
     long long slowlog_log_slower_than;