未分類

  • mysqlエラー(99)

    tcp_tw_recycle tcp_tw_recycleはTIME_WAIT状態にあるコネクションを高速にリサイクルできるようにするためのフラグ。CentOSではデフォルトでは無効になっていたので、有効に。 tcp_fin_timeout これはFIN_WAIT2の状態にあるコネクションの保有時間。デフォルトでは60秒 上記の ip_local_port_range もあわせて/etc/sysctl.confの末尾にこれらを追記 /etc/sysctl.conf net.ipv4.ip_local_port_range = 32768 65000 net.ipv4.tcp_tw_recycle = 1 net.ipv4.tcp_fin_timeout = 10 そしてsysctl -p で反映。 mysqlで(99)なエラーが出たよ、といって困っている人の掲示板でのやり取り(英語) http://lists.mysql.com/mysql/204830 mysqlで(99)ならここ見ろよ、なポインタ(英語) http://www.mysqlperformanceblog.com/2006/11/12/are-php-persistent-connections-evil/ TIME_WAITが長すぎて困ってるの、という人が教えてgoo http://oshiete1.goo.ne.jp/kotaeru.php3?q=2211552 そもそもnetstatとかTIME_WAITとかよくわからん、という人はこちら http://www.atmarkit.co.jp/fwin2k/win2ktips/234netstat/netstat.html FreeBSDの場合も含めて、さらっとスマートに説明してくれてるブログ http://www.sato-bb.net/archive/tech/tune/time_waitmsl/ TUXとかいうサーバの話だけど、途中で「TCPコネクションの飽和を防ぐ」話があった http://itpro.nikkeibp.co.jp/article/COLUMN/20051115/224580/ == 以下追記 == id:kdaibaさんからアドバイスもらったので追記しておきます。 net.ipv4.tcp_tw_recycleを有効にすると、条件によっては、TCPセッションが脹れなくなるトラブルが発生することもありうる、とのこと。 カーネル設定いじる前に以下のブログを読んで、よく理解しておいた方がよさそうです。 http://d.hatena.ne.jp/nice20/20070521#p1 http://d.hatena.ne.jp/nice20/20070517 http://ya.maya.st/d/200804c.html 台場先生、ありがとございました。

    続きを読む

  • X-code Tips

    1. プロジェクト内部の依存関係を図示 http://qiita.com/items/170b899df86952544c17

    続きを読む

  • Objective-C

    IMP,SELとは、、 http://news.mynavi.jp/column/objc/022/index.html

    続きを読む

  • サーバの負荷をしろう!!

    サーバ運用時に必要な負荷測定および対策を整理 サーバのボトルネックを調べる!! Original URL サーバのボトルネックはどうやって調べるか 1:CPU使用率 2:memory使用率 3:ディスクI/O 4:TCPコネクション数 1:CPU使用率 Command: top : CPU別のidleを確認 w : ロードアベレージを確認 (マルチコアの場合 la/コア数が la1以上の時の実際値) マルチコア時代のロードアベレージの見方 sar : CPU別のidleを確認 2:memory使用率 top : free : sar -r : ディスクI/O vmstat : bi/bobを確認 bi:Blocks received from a block device (blocks/s) bo:Blocks sent to a block device (block/s). bi/bo が0ならよい 4:TCPコネクション数 Command: netstat -an : 5:参考サイト…

    続きを読む

  • iOSとunityを統合

    Unityで生成されたiOSソースコードを自作アプリに統合する方法 1:必要なソースファイルの移行 Unityより生成されたソースファイルの中のClassesはLibrariesフォルダの中をすべてXcodeでimport このときmain.mmは除去(あとで参照する) Tagets -> appTaget -> Build Phasesで Add Build Phaseをクリック. Add Run Scriptクリック後Unityで生成されたXcodeのBuild Phasesにあるscriptsをこぴぺー Compile Sourcesで Unity Library fileがすべてリンクされたかを確認. ARCを使用している場合は下記を追加(.m .mmのファイルのCompiler FlagsにARCを利用しないflag) -fno-objc-arc 2:Unityのpchファイルとmain.mmファイルを自分のものと統合 UnityのiPhone_target_Prefix.pchを自分のアプリの.pchファイルと統合。自分で改良を行った場合には独自でマージすること unityのmain.mmソースをprojectのmain.mにコピー ただし以下のソースはそのまま活用 (もとのprojectのmain.mソース) @autoreleasepool { return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); } projectのmain.m をmain.mmに変更 projectのAppDelegateを修正しUnityのwindowを取得可能に AppDelegate.h @class AppController; @property (strong, nonatomic) UIWindow *window; @property (strong, nonatomic) UINavigationController…

    続きを読む

  • Building a iOS Unity + UIView / UIViewController / Interface Builder App

    The original URL : http://alexanderwong.me/post/29949258838/building-a-ios-unity-uiview-uiviewcontroller This is back up for me. Building a iOS Unity + UIView / UIViewController / Interface Builder App When you build your Unity 3D project for the iPhone/iPad, Unity will generate a new Xcode project for you from scratch. It will even overwrite most files on subsequent builds. The design…

    続きを読む

  • Unity + iOS , unityとiOSの連動法

    Objective C : How to show a custom UIView on top of Unity Original Link http://answers.unity3d.com/questions/32848/objectivec-how-to-show-a-custom-uiview-on-top-of-u.html Here’s the code for showing and hiding the view: – (void) showCustomView { UnitySetAudioSessionActive(true); UnityPause(true); self._customUIViewController = [[UIViewController alloc] autorelease]; [[self getTopApplicationWindow] addSubview:self._customUIViewController.view]; if(self._customUIViewController != nil) { FAWController *fawView = [[FAWController alloc] initWithAPIKey:@”d0d” delegate:self]; //some custom initialization [self._customUIViewController presentModalViewController:fawView…

    続きを読む

  • HA proxy 設定

    参考URL http://blog.exceliance.fr/2012/09/10/how-to-get-ssl-with-haproxy-getting-rid-of-stunnel-stud-nginx-or-pound/ cd /usr/src wget http://haproxy.1wt.eu/download/1.5/src/devel/haproxy-1.5-dev12.tar.gz tar xzf haproxy-1.5-dev12.tar.gz cd haproxy-1.5-dev12/ make TARGET=linux2628 USE_STATIC_PCRE=1 USE_OPENSSL=1 –>make TARGET=linux2628 USE_PCRE=1 USE_OPENSSL=1 PCREDIR=/usr/lib64 //USE_STATIC_PCREでエラー static削除 sudo make PREFIX=/opt/haproxy-ssl install

    続きを読む

  • file server 負荷分散

    http://d.hatena.ne.jp/hideden/20091101/1257061316

    続きを読む

  • Apache AB , cakephp config debug モード性能テスト

    cakephp debug on sever spec : web – x1.large *3 db – x1.large *1 ab -n 10000 -c 50 http://social-casino-n-virginia-17478905.us-east-1.elb.amazonaws.com/apis/reveal2 Server Software: Apache/2.2.23 Server Hostname: social-casino-n-virginia-17478905.us-east-1.elb.amazonaws.com Server Port: 80 Document Path: /apis/reveal2 Document Length: 48 bytes Concurrency Level: 50 Time taken for tests: 278.256 seconds Complete requests: 10000 Failed requests: 2 (Connect: 0, Receive: 0,…

    続きを読む