run_ffead.sh 7.7 KB

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