run_ffead.sh 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. #!/bin/sh
  2. rm -f /usr/local/lib/libffead-*
  3. rm -f /usr/local/lib/libte_benc*
  4. rm -f /usr/local/lib/libinter.so
  5. rm -f /usr/local/lib/libdinter.so
  6. export FFEAD_CPP_PATH=${IROOT}/$1
  7. ln -s ${FFEAD_CPP_PATH}/lib/libte_benchmark_um.so /usr/local/lib/libte_benchmark_um.so
  8. ln -s ${FFEAD_CPP_PATH}/lib/libffead-modules.so /usr/local/lib/libffead-modules.so
  9. ln -s ${FFEAD_CPP_PATH}/lib/libffead-framework.so /usr/local/lib/libffead-framework.so
  10. ln -s ${FFEAD_CPP_PATH}/lib/libinter.so /usr/local/lib/libinter.so
  11. ln -s ${FFEAD_CPP_PATH}/lib/libdinter.so /usr/local/lib/libdinter.so
  12. ldconfig
  13. echo never > /sys/kernel/mm/transparent_hugepage/enabled
  14. echo 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' >> /etc/rc.local
  15. sysctl vm.overcommit_memory=1
  16. if [ "$2" = "nginx" ]
  17. then
  18. if [ "$3" = "mysql" ] || [ "$3" = "postgresql" ]
  19. then
  20. export PATH=${IROOT}/nginx-ffead-sql/sbin:${PATH}
  21. else
  22. export PATH=${IROOT}/nginx-ffead-mongo/sbin:${PATH}
  23. fi
  24. fi
  25. export LD_LIBRARY_PATH=${IROOT}/:${IROOT}/lib:${FFEAD_CPP_PATH}/lib:/usr/local/lib:$LD_LIBRARY_PATH
  26. export ODBCINI=${IROOT}/odbc.ini
  27. export ODBCSYSINI=${IROOT}
  28. export LD_PRELOAD=/usr/local/lib/libmimalloc.so
  29. #export LD_PRELOAD=$IROOT/snmalloc-0.4.2/build/libsnmallocshim.so
  30. cd $FFEAD_CPP_PATH
  31. #use below settings only for debugging
  32. #echo '/tmp/core.%h.%e.%t' > /proc/sys/kernel/core_pattern
  33. #ulimit -c unlimited
  34. service redis-server stop
  35. service apache2 stop
  36. service memcached stop
  37. rm -f /tmp/cache.lock
  38. rm -f web/te-benchmark-um/config/cache.xml
  39. rm -f web/te-benchmark-um-pq/config/cache.xml
  40. rm -f web/te-benchmark-um-mgr/config/cache.xml
  41. if [ "$4" = "redis" ]
  42. then
  43. service redis-server start
  44. cp -f web/te-benchmark-um/config/cacheredis.xml web/te-benchmark-um/config/cache.xml
  45. cp -f web/te-benchmark-um-pq/config/cacheredis.xml web/te-benchmark-um-pq/config/cache.xml
  46. cp -f web/te-benchmark-um-mgr/config/cacheredis.xml web/te-benchmark-um-mgr/config/cache.xml
  47. fi
  48. if [ "$4" = "memcached" ]
  49. then
  50. service memcached start
  51. cp -f web/te-benchmark-um/config/cachememcached.xml web/te-benchmark-um/config/cache.xml
  52. cp -f web/te-benchmark-um-pq/config/cachememcached.xml web/te-benchmark-um-pq/config/cache.xml
  53. cp -f web/te-benchmark-um-mgr/config/cachememcached.xml web/te-benchmark-um-mgr/config/cache.xml
  54. fi
  55. if [ "$3" = "mongo" ]
  56. then
  57. rm -f web/te-benchmark-um-pq/config/cache.xml
  58. rm -f web/te-benchmark-um-mgr/config/cache.xml
  59. cp -f web/te-benchmark-um/config/sdormmongo.xml web/te-benchmark-um/config/sdorm.xml
  60. fi
  61. if [ "$3" = "mongo-raw" ]
  62. then
  63. rm -f web/te-benchmark-um-pq/config/cache.xml
  64. rm -f web/te-benchmark-um/config/cache.xml
  65. fi
  66. if [ "$3" = "mysql" ]
  67. then
  68. rm -f web/te-benchmark-um-pq/config/cache.xml
  69. rm -f web/te-benchmark-um-mgr/config/cache.xml
  70. cp -f web/te-benchmark-um/config/sdormmysql.xml web/te-benchmark-um/config/sdorm.xml
  71. fi
  72. if [ "$3" = "postgresql" ]
  73. then
  74. rm -f web/te-benchmark-um-pq/config/cache.xml
  75. rm -f web/te-benchmark-um-mgr/config/cache.xml
  76. cp -f web/te-benchmark-um/config/sdormpostgresql.xml web/te-benchmark-um/config/sdorm.xml
  77. fi
  78. if [ "$3" = "postgresql-raw" ]
  79. then
  80. rm -f web/te-benchmark-um/config/cache.xml
  81. rm -f web/te-benchmark-um-mgr/config/cache.xml
  82. fi
  83. rm -f rtdcf/*.d rtdcf/*.o
  84. rm -f *.cntrl
  85. rm -f tmp/*.sess
  86. if [ ! -d tmp ]; then
  87. mkdir tmp
  88. fi
  89. chmod 700 ffead-cpp*
  90. chmod 700 resources/*.sh
  91. chmod 700 tests/*
  92. chmod 700 rtdcf/*
  93. if [ "$2" = "emb" ]
  94. then
  95. sed -i 's|EVH_SINGLE=false|EVH_SINGLE=true|g' $FFEAD_CPP_PATH/resources/server.prop
  96. for i in $(seq 0 $(($(nproc --all)-1))); do
  97. taskset -c $i ./ffead-cpp $FFEAD_CPP_PATH &
  98. done
  99. fi
  100. if [ "$2" = "lithium" ]
  101. then
  102. ./ffead-cpp-lithium $FFEAD_CPP_PATH &
  103. fi
  104. if [ "$2" = "cinatra" ]
  105. then
  106. ./ffead-cpp-cinatra $FFEAD_CPP_PATH &
  107. fi
  108. if [ "$2" = "drogon" ]
  109. then
  110. ./ffead-cpp-drogon $FFEAD_CPP_PATH &
  111. fi
  112. if [ "$2" = "apache" ]
  113. then
  114. if [ "$3" = "mysql" ] || [ "$3" = "postgresql" ]
  115. then
  116. sed -i 's|/installs/ffead-cpp-5.0|'/installs/ffead-cpp-5.0-sql'|g' /etc/apache2/apache2.conf
  117. sed -i 's|/installs/ffead-cpp-5.0|'/installs/ffead-cpp-5.0-sql'|g' /etc/apache2/sites-enabled/000-default.conf /etc/apache2/sites-enabled/ffead-site.conf
  118. fi
  119. sed -i 's|<pool-size>30</pool-size>|<pool-size>3</pool-size>|g' $FFEAD_CPP_PATH/web/te-benchmark-um/config/sdorm.xml
  120. sed -i 's|<pool-size>10</pool-size>|<pool-size>2</pool-size>|g' $FFEAD_CPP_PATH/web/te-benchmark-um/config/cache.xml
  121. sed -i 's|<pool-size>30</pool-size>|<pool-size>3</pool-size>|g' $FFEAD_CPP_PATH/web/te-benchmark-um-pq/config/sdorm.xml
  122. sed -i 's|<pool-size>10</pool-size>|<pool-size>2</pool-size>|g' $FFEAD_CPP_PATH/web/te-benchmark-um-pq/config/cache.xml
  123. sed -i 's|<pool-size>30</pool-size>|<pool-size>3</pool-size>|g' $FFEAD_CPP_PATH/web/te-benchmark-um-mgr/config/sdorm.xml
  124. sed -i 's|<pool-size>10</pool-size>|<pool-size>2</pool-size>|g' $FFEAD_CPP_PATH/web/te-benchmark-um-mgr/config/cache.xml
  125. apachectl -D FOREGROUND
  126. fi
  127. if [ "$2" = "nginx" ]
  128. then
  129. mkdir -p ${IROOT}/nginxfc/logs
  130. sed -i 's|<pool-size>30</pool-size>|<pool-size>3</pool-size>|g' $FFEAD_CPP_PATH/web/te-benchmark-um/config/sdorm.xml
  131. sed -i 's|<pool-size>10</pool-size>|<pool-size>2</pool-size>|g' $FFEAD_CPP_PATH/web/te-benchmark-um/config/cache.xml
  132. sed -i 's|<pool-size>30</pool-size>|<pool-size>3</pool-size>|g' $FFEAD_CPP_PATH/web/te-benchmark-um-pq/config/sdorm.xml
  133. sed -i 's|<pool-size>10</pool-size>|<pool-size>2</pool-size>|g' $FFEAD_CPP_PATH/web/te-benchmark-um-pq/config/cache.xml
  134. sed -i 's|<pool-size>30</pool-size>|<pool-size>3</pool-size>|g' $FFEAD_CPP_PATH/web/te-benchmark-um-mgr/config/sdorm.xml
  135. sed -i 's|<pool-size>10</pool-size>|<pool-size>2</pool-size>|g' $FFEAD_CPP_PATH/web/te-benchmark-um-mgr/config/cache.xml
  136. if [ "$3" = "mysql" ] || [ "$3" = "postgresql" ]
  137. then
  138. nginx -g 'daemon off;' -c ${IROOT}/nginx-ffead-sql/conf/nginx.conf
  139. else
  140. nginx -g 'daemon off;' -c ${IROOT}/nginx-ffead-mongo/conf/nginx.conf
  141. fi
  142. fi
  143. if [ "$2" = "libreactor" ]
  144. then
  145. cd ${IROOT}
  146. ./libreactor-ffead-cpp $FFEAD_CPP_PATH 8080
  147. fi
  148. if [ "$2" = "crystal-http" ]
  149. then
  150. cd ${IROOT}
  151. for i in $(seq 0 $(($(nproc --all)-1))); do
  152. taskset -c $i ./crystal-ffead-cpp.out --ffead-cpp-dir=$FFEAD_CPP_PATH --to=8080 &
  153. done
  154. fi
  155. if [ "$2" = "crystal-h2o" ]
  156. then
  157. cd ${IROOT}
  158. for i in $(seq 0 $(($(nproc --all)-1))); do
  159. taskset -c $i ./h2o-evloop-ffead-cpp.out --ffead-cpp-dir=$FFEAD_CPP_PATH --to=8080 &
  160. done
  161. fi
  162. if [ "$2" = "rust-actix" ]
  163. then
  164. cd ${IROOT}
  165. ./actix-ffead-cpp $FFEAD_CPP_PATH 8080
  166. fi
  167. if [ "$2" = "rust-hyper" ]
  168. then
  169. cd ${IROOT}
  170. ./hyper-ffead-cpp $FFEAD_CPP_PATH 8080
  171. fi
  172. if [ "$2" = "rust-thruster" ]
  173. then
  174. cd ${IROOT}
  175. ./thruster-ffead-cpp $FFEAD_CPP_PATH 8080
  176. fi
  177. if [ "$2" = "rust-rocket" ]
  178. then
  179. cd ${IROOT}
  180. ./rocket-ffead-cpp $FFEAD_CPP_PATH 8080
  181. fi
  182. if [ "$2" = "go-fasthttp" ]
  183. then
  184. cd ${IROOT}
  185. ./fasthttp-ffead-cpp --server_directory=$FFEAD_CPP_PATH -addr=8080
  186. fi
  187. if [ "$2" = "go-gnet" ]
  188. then
  189. cd ${IROOT}
  190. ./gnet-ffead-cpp --server_directory=$FFEAD_CPP_PATH --port=8080
  191. fi
  192. if [ "$2" = "v-vweb" ]
  193. then
  194. cd ${IROOT}
  195. for i in $(seq 0 $(($(nproc --all)-1))); do
  196. taskset -c $i ./vweb --server_dir=$FFEAD_CPP_PATH --server_port=8080 &
  197. done
  198. fi
  199. if [ "$2" = "v-picov" ]
  200. then
  201. cd ${IROOT}
  202. for i in $(seq 0 $(($(nproc --all)-1))); do
  203. taskset -c $i ./main --server_dir=$FFEAD_CPP_PATH --server_port=8080 &
  204. done
  205. fi
  206. if [ "$2" = "java-firenio" ]
  207. then
  208. cd ${IROOT}
  209. java \
  210. -server \
  211. -XX:+UseNUMA \
  212. -XX:+UseParallelGC \
  213. -XX:+AggressiveOpts \
  214. -Dlite=false \
  215. -Dcore=1 \
  216. -Dframe=16 \
  217. -DreadBuf=512 \
  218. -Dpool=true \
  219. -Ddirect=true \
  220. -Dinline=true \
  221. -Dlevel=1 \
  222. -Dread=false \
  223. -Depoll=true \
  224. -Dnodelay=true \
  225. -Dcachedurl=false \
  226. -DunsafeBuf=true \
  227. -classpath firenio-ffead-cpp-0.1-jar-with-dependencies.jar com.firenio.ffeadcpp.FirenioFfeadCppServer $FFEAD_CPP_PATH 8080
  228. fi
  229. if [ "$2" = "java-rapidoid" ]
  230. then
  231. cd ${IROOT}
  232. java -server -XX:+UseNUMA -XX:+UseParallelGC -XX:+AggressiveOpts \
  233. -classpath rapidoid-ffead-cpp-1.0-jar-with-dependencies.jar \
  234. com.rapidoid.ffeadcpp.Main $FFEAD_CPP_PATH 8080 profiles=production
  235. fi
  236. if [ "$2" = "java-wizzardo-http" ]
  237. then
  238. cd ${IROOT}
  239. java -Xmx2G -Xms2G -server -XX:+UseNUMA -XX:+UseParallelGC -XX:+AggressiveOpts \
  240. -jar wizzardo-ffead-cpp-all-1.0.jar $FFEAD_CPP_PATH 8080 env=prod
  241. fi
  242. wait