Tuesday, December 4, 2018

Reduce TIME_WAIT socket connections


Tune 2 linux kernel parameters to reduce TIME_WAIT sockets.

net.ipv4.tcp_fin_timeout
This specifies how many seconds to wait for a final FIN packet before the socket is forcibly closed.  This is strictly a violation of the TCP specification, but required to prevent denial-of-service attacks.

The default value is 60, but we highly recommend to change to smaller number like 30 or even 15 seconds.

net.ipv4.tcp_tw_reuse
This allows linux to use an existing connection with the TIME_WAIT state, but only for outgoing connections. It will help with connections you establish towards your backend servers, but it has absolutely no effect on incoming connections in any way. If you encounter local port exhausted don't increase local port range (net.ipv4.ip_local_port_range), please enable tcp_tw_reuse kernel parameter.

The default value is 0, but we highly recommend to change to 1.

https://vincent.bernat.ch/en/blog/2014-tcp-time-wait-state-linux
blog gives more details about how to cope with the TCP TIME_WAIT state on busy linux servers.

Key takeaways
  • Enable net.ipv4.tcp_tw_reuse
  • Do not enable net.ipv4.tcp_tw_recycle
  • Enabling net.ipv4.tcp_tw_reuse is useless for incoming connections.
  • The universal solution is to increase the number of possible quadruplets by using, for example, more server ports. This will allow you to not exhaust the possible connections with TIME-WAIT entries.
  • On the client side, enabling net.ipv4.tcp_tw_reuse is another almost-safe solution.

Thursday, November 29, 2018

Hawaii Trip - Day 4

Nov 26, 2018

I got up at 6am because I planned to go hiking for a round trip between Waikiki beach and Diamond Head State Monument. The weather was so nice and scenery was so gorgeous. The sun was coming out and the moon was still in the sky. I can see people jogging, doing yoga, walking, biking and etc.





After passing Department of Defense Fort Ruger, I arrived Fort Ruger Pathway which leading to Le'ahi. The park opens from 6am to 6pm. There is $1 fee for individual walk-in, and the summit hike takes 60-90 minutes for a round trip. If I got up earlier and arrived at 6am promptly, I probably could see the sun rise because weather reported sunrise is 6:38am. Of course, I can take trolley or TheBus to the entry point, but I selected walking all the way for refresh.





After I climbed the summit, I could see the whole picture of crater. I could also see remote mountains, ocean, plants, houses, lighthouse and the city.




When I walked back to Waikiki beach, I passed Kapi' Olani Community College and Culinary Institute of the Pacific, they both be part of University of Hawaii. I also stopped by Queen Kapi'Olani Garden which is really a small one but for sure for memory of the queen. When I arrived at hotel after a quick breakfast at McDonald's, it was almost 10am. Sit by the hotel pool for hot tube to relax my two legs, I checked the photos I taken during the hiking. It totally cost 2.5 hours for 8.6 miles, excluding stop time for picture taking. I really enjoyed this experience.





After checking out from the hotel, I took TheBus to Aloha Tower. It is free to visit the tower at the 10th floor. From there, I could get a better view of the bay and city. This historic tower is just besides Hawaii pacific university. There are many dancing statues.





Walking back to the hotel direction was nice too though it was a bit hot in the noon. After passing Pier 4 US Coastguard and US department of Homeland Security, I took TheBus to Little Sheep Hotpot restaurant for lunch. It is located at 1200 Ala Moana Blvd, Honolulu. I chose All You Can Eat Menu which was so great at about $30 after tax and tip. Highly recommend this place if you like hotpot.




After the lunch, I went to Magic Island. From there, I got another view of the city, the beach and the crater. It was so peaceful and beautiful.




My last stop is Ala Moana Hawaii's Center, another shopping mall.



My return flight was at 10:30pm, so I got plenty time to visit Waikiki beach for the 3rd time. Today's sunset was different from yesterday.




After the sunset, I went to another shopping mall called Royal Hawaiian Center. There was traditional show with Hawaiian dance and music. I ate too much for the lunch, so I got some fruits and sandwich after window shopping the stores.



Roberts Hawaii travel agent picked me up at 8pm from hotel to NHL Airport. No any fruit allowed to other states, so I had to eat the fruits at the airport before security check. The traffic is light at night, so I waited about 1 hour for the flight from Hawaii to LAX via American Airline. I arrived SJC at around 8:30am, then arrived home for a shower and breakfast around 9:15am. After that, I drove to office for work. A new workday began and it concluded my 4 days' trip to Oahu Island.



Keywords: Waikiki Beach, Diamond Head, Aloha Tower, Magic Island, Airport

Hawaii Trip - Day 3

Nov 25, 2018

Oahu is the 3rd largest island of Hawaii state, it is a good planning to tour around the island by self driving or travel agent tour. I booked Grand tour of the island on Expedia.com which is from Roberts Hawaii travel agent.

We set off at 7:30am, the first stop is Hanauma Bay which is most famous for snorkeling. We got 20 minutes stay for photo taking and scenery viewing. This is really a great bay beach for at least half day relax. Entrance fee is $7.5, there are many 3-4 hours' tour for snorkeling here at around $30.


Next stop is Halona Blowhole, which has astonishing coastal view.


After first 2 stops, we came to a shop called "Hawaiian Coral Factory" which provides restroom and free coffee. I just bought some beverage. They sell coral brooch, earrings and Hawaiian clothes. Tour guide gave this stop 30 minutes. It is not uncommon tour guide gives more time stay at shops than POI. That is the cons of taking a tour, but tour guide introduction about the history and culture of Oahu island is the pros.



Nu'uanu Pali Lookout is the 4th stop. It has stories about Kings and last battle in the history. It also has great green mountain view. It was not windy, so we cannot experience the situation tour guide described.



Byodo In temple is our 5th stop. It is located in Valley of the Temples Memorial park. This is a place deserves visiting. The Japanese style temple was built in the park, with water in the front, and mountain at the back. It has very good fengshui from Asian tradition. There is Buddha inside of the temple. There are many big fishes in the pond. If we get more time to stay, we can feed the fish, take some short hiking around the temple.





The six stop came to Macadamia Farm Outlet at Kaneohe. This shop provides nuts tasting, free coffee, and of course all kinds of souvenirs. Again we got 40 minutes stay, so that we could shop around.


The 7th stop was Kualoa Ranch for tram tour and lunch. It didn't provide any surprise from the 20 minutes tram tour. This ranch also provides other activities like horse riding, Jeep ride, zipline and Jurassic Park tour etc, but each activity needs extra money and time. From introduction and my experience with the tram tour, I don't suggest to take their activities except for Jurassic Park (movie taken spot). We got 1 hour for the lunch, some tourists booked buffet lunch, and some didn't. It was a right decision to not book lunch for me. I like to purchase lunch from ranch cafe menu than the plain and simple buffet. This ranch was built from Kualoa Sugar Mill, but now it is purely for tourism and activities.





After the lunch, it was a long ride around the coastal line. Tour guide gave a lot of introduction about the beaches, bays and surfing at the north shore. We also passed Polynesian Cultural center which was closed on Sunday, passed Laie college, came to fruit stand at Kahuku. Tour guide (the driver) gave us 20 minutes stop for fresh fruit purchase. This was the 8th stop.





Back to bus, we headed to our last and 9th stop Dole Plantation. During the ride, we passed sunset point beach park, Waimea bay beach park etc. Dole Plantation has very beautiful garden and tasteful Dole whip. They also sell BBQ corn at $5 which seems to be popular. I bought one whip at $6.5 which is similar to Yogurtland here. Dole Plantation has train ride, maze etc activities, but we don't have enough time to play. Usually the tourists can take pictures, use bathroom, and taste some deserts.






We returned to Waikiki around 5pm, passing through pearl harbor, airport, downtown, Aloha Tower, Ala Moana etc. Heading to Waikiki beach to watch the sunset was the right decision. It was fabulous to lay on the sand and watch the sunset. The sky, the sea, the beach, the hotel, the diamond head, the people under the sunset, what a unforgettable memory and astonish view.





After it was dark, I was leaving the beach to international market place. There was daily night show regarding Hawaii tradition, the stories about king and queen, and of course the Hawaiian music and dance. After the show, I came to 3rd floor for a dinner. I selected Goma Tei Ramen Waikiki which is owned by Chinese, but it tastes so good, highly recommend it. In the Mitsuwa Marketplace, there is Hokkaido Ramen too. I really enjoyed the atmosphere at this shopping mall.





Keywords: Waikiki beach, Hanauma Bay, Halona Blowhole, Pali lookout, Byodo In temple, Kualoa Ranch, Dole Plantation