跳到主要內容

發表文章

DynamoDB 名詞概念

DynamoDB Download Localhost DynamoDB Table 類似於 RDBMS 的 Table. DynamoDB Table 是一個儲存集合單位。 相當於 MongoDB 的 Collection Items 每個 Table 可以有多個 Items,相當於 RDBMS 的 Rows。 每個 Items 可包含多個 Attributes 相當於 MongoDB 的 Document Attributes: 每個 Items 由一個或多個 Attributes 組成 Attributes 支援最深 32 個層級 Example People Table { "PersonID":"101", "LastName":"Simtih", "FirstName":"Fred", "Phone":"123-456", }, { "PersonID":"102", "LastName":"Jones", "FirstName":"Anytown", "Address":{ "Street":"123 Main", "City":"Anytown", "Zip":123 } } Primary Key Partitiion Key 相當於 RDS 的 Unique Key, 有一組不會重複的 hash value Partition Key + Sort Key (複合鍵) 先找到 unique key 再依照 sort key 做索引, hash + range Hash : select * from xxx where id = hash Hash + range : select * from xxx wh...

GCP Storage 簡介

GCP Storage 簡介 Overview of storage classes 1.Multi-Regional Storage 適合存放經常存取的 "Hot Data" 或者影音串流(streaming videos),有異地備份的功能。 2.Regional Storage 適合存放與 Google Compute Engine Instance 或 Google Cloud DataProc 服務互相配合的資料,在相同的 Regional 可以降低 latency。Google Compute Engine 跟 Google Cloud DataProc 這些 instances 都是拿來處理, 清理, 運算資料用, 要分析的資料適合用這種類型的儲存。存放的費用比 Multi-Regional 還要低一點($0.016 GB/Month)。 3.Nearline Storage 適合存放較低存取的 "Cold Data",比如每月(隔 30 天才會存取一次)需要存取或修改一次的資料,或者適用於一些資料備份(用來回復跟救援的資料),支援整合 AWS Glacier 轉移。 4.Coldline Storage 適合存放較低存取的 "Cold Data",比起 Nearline Storage,Coldline Storage 更適合線上備份跟救援回復的資料(隔 90 天才會存取一次)。 Pricing https://cloud.google.com/storage/pricing Standar Storage 的建議 如果不清楚,資料的存取用途,建議使用 Standard Storage buckets

用 shell 解析 Json 的好工具 jq

JQ tutorial Sample $docker network inspect bridge [{ "Name": "bridge", "Id": ""fake-id", "Created": "2017-07-05T01:07:55.747497179Z", "Scope": "local", "Driver": "bridge", "EnableIPv6": false, "IPAM": { "Driver": "default", "Options": null, "Config": [{ "Subnet": "172.17.0.0/16", "Gateway": "172.17.0.1" }] }, "Internal": false, "Attachable": false, "Ingress": false, "ConfigFrom": { "Network": "" }, "ConfigOnly": false, "Containers": { "b59a12af7c87621b43c95a9adbcf047076b8a4b6b6ce0d6c5e6e48e21188ce6a": { "Name": "heuristic_rosalind", "EndpointID": "fake-endpoint-id", "MacAddr...

Java MockWebServer 的心得

Retrofit2 + OKHttp3 真是神器 很久之前寫了剛開始寫 Java ,整理了一下自己在 spring 上使用 Retrofit2 與 okHttp3 的使用 心得 。 最近又發現 OKHttp3 plugin MockWebServer。在做第三方 API 測試的時候,真的滿方便的。 MockWebServer 使用 Retrofit 建立一個 FacebookService , 建立方式, 參考之前的 心得 public interface FacebookService { @GET("{userId}?fields=id, name") Call getFbUser(@Path("userId") String userId, @Query("access_token") String token); } 測試 @RunWith(SpringJUnit4ClassRunner.class) @SpringApplicationConfiguration(classes = MockWebServerDemo.class) @WebAppConfiguration public class MockWebServerTest { private MockWebServer mockWebServer; private FacebookService facebookService; private ObjectMapper objectMapper; @Before public void setUp() { // Jackson objectMapper objectMapper = new ObjectMapper(); objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); objectMapper .registerModule(new JodaModule()) .configure(De...

Web 可以裸奔多久

輕鬆的口吻,嚴肅的態度,來看一下 Server 上線後的資安問題。 PHP DevOps https://medium.com/@Negaihoshi/%E6%9C%8D%E5%8B%99%E9%83%A8%E7%BD%B2%E6%80%9D%E8%B7%AF-35b8b905d5fe 常見的探測與攻擊手法 http://rdcqii.hundsun.com/portal/article/447.html OS 工具與設定 https://plusbryan.com/my-first-5-minutes-on-a-server-or-essential-security-for-linux-servers

Java Process And Thread 筆記

英文很差,所以附上原文。 關係大概是這樣吧 Processes And Threads Processes (進程) 每個 Process 都可視為一個獨立運作的環境,有自己完整、私有的 Run-Time 資源,特別是每個 process 都有自己的記憶體空間。 Processes 聽起來很像 programs 或 application 的另一種說法,然而事實上一個 application 有可能是許多 processes 合作組成的。為了讓 processes 彼此互相合作,一些作業系統支援了 Inter Process Communication (IPC) resources,例如 pipes 與 sockets。IPC 不只讓不同的 processes 互相通訊,同時也支援不同系統的 pocesses 互相通訊。 大部分 JVM 實現的都是 single process。Java Application 可以創建額外的 process 透過 ProcessBuilder Object。 A process has a self-contained execution environment. A process generally has a complete, private set of basic run-time resources; in particular, each process has its own memory space. Processes are often seen as synonymous with programs or applications. However, what the user sees as a single application may in fact be a set of cooperating processes. To facilitate communication between processes, most operating systems support Inter Process Communication (IPC) resources, such as pipes and sockets. IPC is used not just for communication b...