Giter Club home page Giter Club logo

isucon4-mokumoku's People

Contributors

luvtechno avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

isucon4-mokumoku's Issues

mysql

mysql -h 127.0.0.1 -P 3306 -u root isu4_qualifier
CREATE TABLE IF NOT EXISTS `users` (
  `id` int NOT NULL AUTO_INCREMENT PRIMARY KEY,
  `login` varchar(255) NOT NULL UNIQUE,
  `password_hash` varchar(255) NOT NULL,
  `salt` varchar(255) NOT NULL
) DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `login_log` (
  `id` bigint NOT NULL AUTO_INCREMENT PRIMARY KEY,
  `created_at` datetime NOT NULL,
  `user_id` int,
  `login` varchar(255) NOT NULL,
  `ip` varchar(255) NOT NULL,
  `succeeded` tinyint NOT NULL
) DEFAULT CHARSET=utf8;
mysql> SHOW INDEX FROM login_log;
+-----------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table     | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+-----------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| login_log |          0 | PRIMARY  |            1 | id          | A         |       71722 |     NULL | NULL   |      | BTREE      |         |               |
+-----------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
1 row in set (0.00 sec)

mysql> SHOW INDEX FROM users;
+-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| users |          0 | PRIMARY  |            1 | id          | A         |      200183 |     NULL | NULL   |      | BTREE      |         |               |
| users |          0 | login    |            1 | login       | A         |      200183 |     NULL | NULL   |      | BTREE      |         |               |
+-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
2 rows in set (0.00 sec)

mysql> SELECT COUNT(1) FROM login_log;
+----------+
| COUNT(1) |
+----------+
|    71294 |
+----------+
1 row in set (0.02 sec)

mysql> SELECT COUNT(1) FROM users;
+----------+
| COUNT(1) |
+----------+
|   200000 |
+----------+
1 row in set (0.02 sec)

service

$ service --status-all
acpid is stopped
atd (pid  2957) is running...
auditd (pid  2109) is running...
cfn-hup is stopped
Stopped
cgred is stopped
Checking for service cloud-init:Checking for service cloud-init:Checking for service cloud-init:Checking for service cloud-init:crond (pid  2947) is running...
/etc/init.d/ip6tables: line 53: /etc/sysconfig/ip6tables-config: Permission denied
/etc/init.d/iptables: line 53: /etc/sysconfig/iptables-config: Permission denied
lvmetad is stopped
mdmonitor is stopped
messagebus (pid  2149) is running...
mysqld status unknown due to insufficient privileges.
netconsole module not loaded
Configured devices:
lo eth0
Currently active devices:
lo eth0
nginx (pid  2939) is running...
ntpd (pid  2627) is running...
Process accounting is disabled.
racoon is stopped
rdisc is stopped
rsyslogd status unknown due to insufficient privileges.
saslauthd is stopped
/etc/init.d/sshd: line 33: /etc/sysconfig/sshd: Permission denied
openssh-daemon (pid  2606) is running...
supervisord (pid  2966) is running...

/etc/sysctl.conf

# Kernel sysctl configuration file for Red Hat Linux
#
# For binary values, 0 is disabled, 1 is enabled.  See sysctl(8) and
# sysctl.conf(5) for more details.

# Controls IP packet forwarding
net.ipv4.ip_forward = 0

# Controls source route verification
net.ipv4.conf.default.rp_filter = 1

# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0

# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0

# Controls whether core dumps will append the PID to the core filename.
# Useful for debugging multi-threaded applications.
kernel.core_uses_pid = 1

# Controls the use of TCP syncookies
net.ipv4.tcp_syncookies = 1

# Disable netfilter on bridges.
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0

# Controls the default maxmimum size of a mesage queue
kernel.msgmnb = 65536

# Controls the maximum size of a message, in bytes
kernel.msgmax = 65536

# Controls the maximum shared segment size, in bytes
kernel.shmmax = 68719476736

# Controls the maximum number of shared memory segments, in pages
kernel.shmall = 4294967296

# Maximize console logging level for kernel printk messages
kernel.printk = 8 4 1 7
kernel.printk_ratelimit_burst = 10
kernel.printk_ratelimit = 5

supervisord

つかいかたがまったくわからない。

$ cat /etc/supervisord.conf
[unix_http_server]
file=/tmp/supervisor.sock
chown=root:wheel
chmod=0770

[supervisorctl]
serverurl=unix:///tmp/supervisor.sock

[supervisord]
logfile=/tmp/supervisord.log
loglevel=info
pidfile=/var/run/supervisord.pid
nodaemon=false
minfds=1024
minprocs=200

[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

[program:isucon_ruby]
directory=/home/isucon/webapp/ruby
command=/home/isucon/env.sh foreman start
user=isucon
stdout_logfile=/tmp/isucon.ruby.log
stderr_logfile=/tmp/isucon.ruby.log
autostart=true

[program:isucon_python]
directory=/home/isucon/webapp/python
command=/home/isucon/env.sh gunicorn -c gunicorn_config.py app:app
user=isucon
stdout_logfile=/tmp/isucon.python.log
stderr_logfile=/tmp/isucon.python.log
autostart=false

[program:isucon_php]
directory=/home/isucon/webapp/php
command=/home/isucon/env.sh php-fpm -y /home/isucon/webapp/php/php-fpm.conf
user=isucon
stdout_logfile=/tmp/isucon.php.log
stderr_logfile=/tmp/isucon.php.log
autostart=false

[program:isucon_perl]
directory=/home/isucon/webapp/perl
command=/home/isucon/env.sh carton exec plackup -s Starman --host localhost:8080 -E prod app.psgi
user=isucon
stdout_logfile=/tmp/isucon.perl.log
stderr_logfile=/tmp/isucon.perl.log
autostart=false

[program:isucon_node]
directory=/home/isucon/webapp/node
command=/home/isucon/env.sh node app.js
user=isucon
stdout_logfile=/tmp/isucon.node.log
stderr_logfile=/tmp/isucon.node.log
autostart=false

[program:isucon_go]
directory=/home/isucon/webapp/go
command=/home/isucon/env.sh ./golang-webapp
user=isucon
stdout_logfile=/tmp/isucon.go.log
stderr_logfile=/tmp/isucon.go.log
autostart=false

nginx

$ sudo service nginx restart
Stopping nginx:                                            [  OK  ]
Starting nginx:                                            [  OK  ]
ls -al /etc/nginx/
total 76
drwxr-xr-x  3 root root 4096 Sep 27  2014 .
drwxr-xr-x 76 root root 4096 Sep 23 05:24 ..
drwxr-xr-x  2 root root 4096 Sep 24  2014 conf.d
-rw-r--r--  1 root root 1034 Aug 27  2014 fastcgi.conf
-rw-r--r--  1 root root 1034 Aug 27  2014 fastcgi.conf.default
-rw-r--r--  1 root root  964 Aug 27  2014 fastcgi_params
-rw-r--r--  1 root root  964 Aug 27  2014 fastcgi_params.default
-rw-r--r--  1 root root 2837 Aug 27  2014 koi-utf
-rw-r--r--  1 root root 2223 Aug 27  2014 koi-win
-rw-r--r--  1 root root 3957 Aug 27  2014 mime.types
-rw-r--r--  1 root root 3957 Aug 27  2014 mime.types.default
-rw-r--r--  1 root root  187 Sep 27  2014 nginx.conf
-rw-r--r--  1 root root 2656 Aug 27  2014 nginx.conf.default
-rw-r--r--  1 root root 1543 Sep 27  2014 nginx.php.conf
-rw-r--r--  1 root root  596 Aug 27  2014 scgi_params
-rw-r--r--  1 root root  596 Aug 27  2014 scgi_params.default
-rw-r--r--  1 root root  623 Aug 27  2014 uwsgi_params
-rw-r--r--  1 root root  623 Aug 27  2014 uwsgi_params.default
-rw-r--r--  1 root root 3610 Aug 27  2014 win-utf
$ cat nginx.conf
worker_processes  1;

events {
  worker_connections  1024;
}

http {
  upstream app {
    server 127.0.0.1:8080;
  }

  server {
    location / {
      proxy_pass http://app;
    }
  }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.